试图在
xcode的新故事板上设计
iphone UI:
对于设计iphone UI来说,这似乎有点随意.
我期待某种形式的’iphone”ipad”可扩展’的界限或线条,但我能找到的就是这个单一的故事板.它现在真的只是单个故事板还是我缺少一些额外的控件?
解决方法
从XCode 6开始,使用名为Size Classes的新功能组合了iPhone和iPad的故事板.这是一件好事(大部分时间),因为它可以让你设计一个适应不同屏幕尺寸的界面.
当然,在某些情况下,您可能希望为iPhone和iPad使用不同的故事板.毕竟,有些应用只需要在手掌和平板电脑尺寸的设备上采用完全不同的方法.
如果你想使用新的Size Classes,请参阅越来越多的教程之一,比如Ray Wenderlich:http://www.raywenderlich.com/83276/beginning-adaptive-layout-tutorial.
如果您想为iPhone和iPad使用单独的故事板,请按以下步骤操作:
>从新的单视图应用程序开始.
a. Select File|New|Project. b. Select iOS,Application and click "Single View Application." c. Click Next. d. Give the project a name,then click "Next." e. Pick a location and click "Create" to create the project.
>将起始故事板转换为iPhone故事板.
a. Select Main.storyboard,and select the file inspector (the document icon at the top of the right pane) if it is not already selected. b. Uncheck "Use Size Classes."
c. A dlialog will appear. Select "iPhone" from the drop down menu,then click "Disable Size Classes."
d. Rename the storyboard as "Main_iPhone.storyboard."
>创建iPad故事板.
a. Select File|New|File from the menu bar. From the dialog that appears,select iOS|UserInterface. Click on "Storyboard" and click "Next."
b. Rename the file as "Main_iPad.storyboard," then save it,typically in the Base.lproj folder of your project folder.
c. Add a view controller,and make it the initial view controller by clicking the "Is Initial View Controller" check Box in the Attributes Inspector pane.
>按照与上面#2相同的步骤将新故事板转换为iPad故事板,但这次选择平台时选择iPad而不是iPhone.
>将故事板链接到应用程序.
a. Open the Info.plist. b. Change the name for "Main storyboard file base name" from "Main" to "Main_iPhone.storyboard". .c Add a new property called "Main storyboard file base name (iPad)" and give it the name "Main_iPad."
而已!您现在可以像往常一样为iPhone和iPad创建单独的UI.