试图在xcode的新故事板上设计iphone UI:


对于设计iphone UI来说,这似乎有点随意.
我期待某种形式的'iphone''ipad''可扩展'的界限或线条,但我能找到的就是这个单一的故事板.它现在真的只是单个故事板还是我缺少一些额外的控件?
Mik*_*ike 16
从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.
Run Code Online (Sandbox Code Playgroud)将起始故事板转换为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."
Run Code Online (Sandbox Code Playgroud)
c. A dlialog will appear. Select "iPhone" from the drop down menu, then click "Disable Size Classes."
Run Code Online (Sandbox Code Playgroud)

d. Rename the storyboard as "Main_iPhone.storyboard."
Run Code Online (Sandbox Code Playgroud)

创建iPad故事板.
a. Select File|New|File from the menu bar. From the dialog that appears, select iOS|UserInterface. Click on "Storyboard" and click "Next."
Run Code Online (Sandbox Code Playgroud)
b. Rename the file as "Main_iPad.storyboard," then save it, typically in the Base.lproj folder of your project folder.
Run Code Online (Sandbox Code Playgroud)

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.
Run Code Online (Sandbox Code Playgroud)

按照与上面#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."
Run Code Online (Sandbox Code Playgroud)
而已!您现在可以像往常一样为iPhone和iPad创建单独的UI.
| 归档时间: |
|
| 查看次数: |
4131 次 |
| 最近记录: |