我有一个iPhone应用程序,它有一个故事板。现在我还想提供一个iPad应用程序。我问自己是否有一个函数可以帮助我将iPhone的故事板转换成iPad的故事板。

具体来说:

是否有类似的功能,还是只有手动的方式?


当前回答

1. Create New Storyboard file with MainStoryboard_iPad.storyboard
2. Copy All the views from MainStoryboard and paste to MainStoryboard_iPad.storyboard

其他回答

1 -创建“MainStoryboard_iPad.storyboard”;

2 -右键单击“MainStoryboard_iPhone.”故事板”和“打开作为->源代码”。所有复印件;

3-右键单击“MainStoryboard_iPad”。故事板”和“打开作为->源代码”。粘贴了一切。现在搜索和改变:

targetRuntime = " iOS。CocoaTouch" to targetRuntime="iOS.CocoaTouch.iPad" type = " com.apple.InterfaceBuilder3.CocoaTouch.Storyboard。" to type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.iPad.XIB"

4 -保存。现在重新打开,但是使用接口构建器。你只需要重新安排。

此方法也可用于.xib文件

这个功能现在是内置的。例如,如果将“部署信息->设备”中的项目设置从iPhone更改为Universal,则会出现以下对话框:

进入目标摘要,将设备更改为通用, 然后向下设置iPad版本为任何你喜欢的故事板,包括一个复制和重命名一个如果你喜欢。

当我昨天遇到同样的问题时,我关注了这个帖子。我遵循的步骤

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.

就是这样。谢谢你的帮助。

这对我不太管用。我做了一些不同的事情。

为iPad版本创建一个新的故事板文件 在textwrangler(文本编辑器)中打开新文件和我想复制的文件 在这些xml标记之间将xml文本从旧文件复制到新文件 第一个标签<scenes> <!——内容视图控制器——> 粘贴在这里 结束标签</class> </classes> .结束标签

这对我很管用。我得到了一个新的布局,所有的插座都连接在一起,这为我节省了几个小时。