Xcode 6.1 iPhone/iPad故事板

6
尝试在xcode的新storyboard上设计iPhone UI:
这种方式对于只设计iPhone UI来说似乎有些随意。
我期望能看到一些界定“iPhone”、“iPad”或可扩展性的边界或线条,但我只能找到这一个单独的storyboard。 现在真的只有一个storyboard吗?还是我错过了其他控件?

1
查找自动布局,或者如果你像我一样老派的话,可以使用 Springs 和 Struts。 - Undo
我不介意单一视图,我认为它应该是集中的,并且有额外的空间可用于iPad。或者至少指示何时何地查看某些东西。哦好吧,感谢这个提示。 - Simon.
2个回答

16

从XCode 6开始,iPhone和iPad的故事板使用一个名为“Size Classes”的新功能合并了。大多数情况下这是件好事,因为它使您能够设计一个界面,可以适应不同的屏幕大小。

当然,有些情况下您可能想在iPhone和iPad上使用不同的故事板。毕竟,有些应用程序在手机和平板设备上需要完全不同的方法。

如果您想使用新的Size Classes,请参阅日益增长的教程之一,例如Ray Wenderlich的Beginning Adaptive Layout Tutorial

如果您想要为iPhone和iPad使用单独的故事板,以下是方法:

  1. 从一个新的Single View Application开始。

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."
    

    选择 iPhone 并点击禁用尺寸类别

        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."
    

    enter image description here

        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.
    

    enter image description here

    1. 按照步骤2的方法转换新的故事板,只不过这次在选择平台时,请选择iPad而不是iPhone。

    2. 将故事板链接至应用程序。

    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创建不同的用户界面了。

    1
    希望上帝会照顾你...谢谢,我通过你的问题解决了我的问题 :) - Gökhan Çokkeçeci

    1
    在“实用工具区”中选择您的故事板。 显示“属性检查器 > 模拟指标 > 尺寸 > 选择大小”。

    网页内容由stack overflow 提供, 点击上面的
    可以查看英文原文,
    原文链接