ios – 如何/是否在Xcode中制作通用故事板

Xcode中创建故事板文件时,您必须选择是否适用于iPhone或iPad.这意味着应始终将iPhone和iPad UI放入单独的故事板中.这是真的?

我的应用程序有多个故事板.虽然Main.storyboard文件在iPhone和iPad之间存在很大差异,但其他故事板几乎完全相同.唯一的区别可能是推动iPhone与iPhone上的popover,可以通过编程方式处理.制作两个故事板似乎非常愚蠢和多余.

因此,如果制作一个“通用”故事板,是否应该在Xcode中选择iPhone或iPad?有关系吗?

解决方法

从Xcode 6开始,我们可以为所有设备创建一个统一的故事板.
欲了解更多信息 – 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.

编辑:它仅支持iOS 8(向后兼容仅适用于iOS 7)及更高版本.

相关文章

UITabBarController 是 iOS 中用于管理和显示选项卡界面的一...
UITableView的重用机制避免了频繁创建和销毁单元格的开销,使...
Objective-C中,类的实例变量(instance variables)和属性(...
从内存管理的角度来看,block可以作为方法的传入参数是因为b...
WKWebView 是 iOS 开发中用于显示网页内容的组件,它是在 iO...
OC中常用的多线程编程技术: 1. NSThread NSThread是Objecti...