我们是否需要使用2 Storyboard作为通用应用程序? [英] Do we need to use 2 Storyboard for a Universal app?

查看:109
本文介绍了我们是否需要使用2 Storyboard作为通用应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个iPhone和iPad项目。 iPad需要一个分割视图控制器。我们创建两个独立的故事板吗?一个用于iPhone(使用自动布局我们可以支持所有设备)和两个用于iPad。我怀疑的是它只是在初始视图中的差异。内部视图重复。你的故事板方法怎么样?

I have a project for iPhone and iPad. The iPad needs a split view controller. Do we create two separate storyboards? One for iPhone (using autolayout we can support all devices) and two for iPad. My doubt is the difference it only in initial view. The inside views repeats. How will be your approach with storyboard ?

推荐答案

在iOS 8中不再需要两个故事板了!我们可以使用自适应UI来定制所有不同尺寸的iPad和iPhone的相同故事板。

No need for two storyboards any more in iOS 8! We can use Adaptive UI in order to tailor the same storyboard all different sizes of iPad and iPhone.

你可以在这里找到一个很好的教程http://www.raywenderlich.com/83276/beginning-adaptive-layout-tutorial

You can find a nice tutorial in here http://www.raywenderlich.com/83276/beginning-adaptive-layout-tutorial

你也可以在WWDC大会上找到一个很棒的视频,这里和搜索使用UIKit构建自适应应用程序

And also you can find a nice video by apple in WWDC conference here and search for "Building Adaptive Apps with UIKit"

基本上,我们可以通过在故事板中为不同大小的类定义UI的元素来处理不同的屏幕大小。我们还可以为不同的大小类定义不同的自动布局约束。

Basically we can handle different screen sizes by defining elements of our UI in storyboard for different size classes. We can also define different Auto layout constraints for different size classes.

这些都是iOS 8中可能的大小类(我从 https://medium.com/@getaaron/ios-8-development-tips- for-iphone-6-and-iwatch-1c772554ffe0

And these are all possible size classes in iOS 8 ( I took the image from https://medium.com/@getaaron/ios-8-development-tips-for-iphone-6-and-iwatch-1c772554ffe0)

这篇关于我们是否需要使用2 Storyboard作为通用应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆