iOS 如何 分别为 iPad 和 iPhone 建立 不同的 storyboard
写了一个iphone的程序,storyboard是iphone的,如果想将程序转为ipad的storyboard也支持。需要做一下几个步骤
1、选中storyboard文件,假设名字为Main.storyboard
2、File--->duplicate,将文件命名为Main_ipad.storyboard
3、在plist文件中添加两项,Main storyboard file base name (iPhone) (Main storyboard file base name 默认为iPhone版)和Main storyboard file base name (iPad),其值分别对应1和2的两个storyboard。删掉原来的key:Main storyboard file base name value: Main

4、右键Main_ipad.storyboard,open as ---> source code,找到targetRuntime,将其修改为targetRuntime="iOS.CocoaTouch.iPad"
5、最后一步,选中项目-----> targets----->general,将devices改为universal。

运行你的程序,分别选中iphone和ipad simulator,对应的是不同的storyboard。
网友评论