How/whether to make a universal storyboard in Xcode

前端 未结 2 463
长发绾君心
长发绾君心 2021-01-12 10:40

When creating a storyboard file in Xcode, you must select if it is for iPhone or iPad. This implies one should always put iPhone and iPad UIs into separate storyboards. Is

相关标签:
2条回答
  • 2021-01-12 10:58

    As of Xcode 6, we can create a single unified storyboard for all the devices. For more info - Documentation

    iOS 8 makes dealing with screen size and orientation much more versatile. It is easier than ever to create a single interface for your app that works well on both iPad and iPhone, adjusting to orientation changes and different screen sizes as needed. Design apps with a common interface and then customize them for different size classes. Adapt your user interface to the strengths of each form factor. You no longer need to create a specific iPad storyboard; instead target the appropriate size classes and tune your interface for the best experience.

    There are two types of size classes in iOS 8: regular and compact. A regular size class denotes either a large amount of screen space, such as on an iPad, or a commonly adopted paradigm that provides the illusion of a large amount of screen space, such as scrolling on an iPhone. Every device is defined by a size class, both vertically and horizontally. iPad size classes shows the native size classes for the iPad. With the amount of screen space available, the iPad has a regular size class in the vertical and horizontal directions in both portrait and landscape orientations.

    Edit: It only supports iOS 8(backward compatible applies only for iOS 7) and later.

    0 讨论(0)
  • 2021-01-12 11:08

    You've got to create to separate storyboards for each kind of device. If you would delete the iPad storyboard, than your app would use the iPhone's one. You'll realize it when you'll see the 2x button at the bottom of the screen. Everything will be scaled to fit the larger screen - and the graphics would be really bad.

    The only suitable workaround is to copy-paste everything from your iPhone Storyboard to iPad storyboard. Just follow the next steps:

    1. Open iPhone.storyboard,
    2. Press CMD+A, enter image description here
    3. Press CMD+C,
    4. Switch to iPad.storyboard,
    5. Press CMD+V, enter image description here
    6. You'll see, that all the screens, segues, properties and actions are transferred to your new storyboard. All that you have to do is to fix the frames of all your elements so that they'll suit new screen sizes.

    And don't forget, that a good iPad application shouldn't be the same as the iPhone version. There are a lot of cool things which you can do with iPad!

    0 讨论(0)
提交回复
热议问题