我有一个iPhone应用程序,它有一个故事板。现在我还想提供一个iPad应用程序。我问自己是否有一个函数可以帮助我将iPhone的故事板转换成iPad的故事板。
具体来说:
是否有类似的功能,还是只有手动的方式?
我有一个iPhone应用程序,它有一个故事板。现在我还想提供一个iPad应用程序。我问自己是否有一个函数可以帮助我将iPhone的故事板转换成iPad的故事板。
具体来说:
是否有类似的功能,还是只有手动的方式?
当前回答
你应该在苹果公司创建一个错误报告。你可以说它是我的(10167030)的副本,它自2011年9月以来一直开放。从我的角度来看,令人沮丧的事情是Xcode 3中就有这个功能……
其他回答
如果你创建了一个通用项目,默认情况下会创建空的iPad storyboard,你只需要选择iPhone storyboard select all (Command+ a),复制(Command+C),然后粘贴到iPad storyboard上。在编译之前,请确保将入口点从空故事板移动到新复制的故事板。
通过阅读stackoverflow上的许多线程,我发现解决方案是-
1.复制你的iPhone-Storyboard并重命名为MainStoryboard_iPad.storyboard
2.右击故事板->“打开为”->“源代码”。
3.搜索targetRuntime="iOS "。CocoaTouch,然后把它改成targetRuntime=" ios。CocoaTouch。ipad "
5.搜索<simulatedScreenMetrics key="destination" type="retina4"/>并将其更改为<simulatedScreenMetrics key="destination"/>
4.现在保存所有内容,右键单击MainStoryboard_iPad。storyboard " open as " ->"IOS storyboard " 5. 您可能还必须更改您的约束条件。 这就是你所做的一切。
当我昨天遇到同样的问题时,我关注了这个帖子。我遵循的步骤
For Xcode 5.1, I had to do some cleanup of iPhone storyboard like missing reuseIdentifiers of Table cells, provide story board id for every controller, remove unused scenes. Copy MainStoryboard_iPhone.storyboard to MainStoryboard_iPad.storyboard. Using vi editor - changed targetRuntime="iOS.CocoaTouch" to targetRuntime="iOS.CocoaTouch.iPad" Change the code in the MainStoryboard_iPad.storyboard from: <simulatedScreenMetrics key="destination" type="retina4"/> to <simulatedScreenMetrics key="destination"/> Open the project in Xcode. Changed the Deployment devices to Universal - Chose the option of NOT copying the iPhone Storyboard. Xcode will default the Deployment Target to 7.1, took care of the deprecated functions. To fix the misplaced view error in iPad Storyboard - Changed the Frame Layout for Controllers giving errors.
就是这样。谢谢你的帮助。
只是为了好玩,在XCode 5.1和iOS 7.1上,我还需要改变“toolVersion”和“systemVersion”的值:
toolsVersion="5023" systemVersion="13A603"
如果没有这个,新的故事板文件将无法编译
最简单和最可靠的方法是从你的iPad故事板复制粘贴。
创建一个新的故事板,并将其命名为MainStoryboard_ipad。 通过在你的项目的目标属性的Summary页上将Devices属性设置为Universal,使你的应用程序成为Universal应用程序。 打开你的iPhone故事板,选择全部并复制 打开你的iPad故事板并粘贴。
你将不得不调整大小,但这可能比重新创建整个故事板更快。