简体   繁体   English

如何创建一个适用于iPhone 4至iPhone 6 Plus的XIB,而无需使用尺寸类和情节提要?

[英]How to create a XIB that works from iPhone 4 to iPhone 6 Plus without using size classes and storyboards?

I have to design an application that supports iOS versions from 6.1 to 8.1. 我必须设计一个支持6.1至8.1的iOS版本的应用程序。 In order to support iOS 6.1, i can't create storyboards with size classes. 为了支持iOS 6.1,我无法创建具有大小类的情节提要。 So i have to use only XIBs and use auto layout for the XIBs. 所以我只需要使用XIB并为XIB使用自动布局。

When i run my application in Xcode 6.1, it looks like all the layouts are perfectly fine. 当我在Xcode 6.1中运行我的应用程序时,看起来所有布局都很好。 But when i run the same application in Xcode 5.1.1, all the views are reshuffled starting from iPhone 4 to iPhone 5. 但是,当我在Xcode 5.1.1中运行相同的应用程序时,从iPhone 4到iPhone 5的所有视图都被重新排列。

Now i have to design my XIBs in such a way that the views are layed out properly in all the devices from iPhone 4 to iPhone 6 Plus. 现在,我必须以某种方式设计XIB,以便在从iPhone 4到iPhone 6 Plus的所有设备中正确放置视图。 Can someone please suggest me a proper way of how i can create the XIBs that supports all the devices? 有人可以建议我一种正确的方式来创建支持所有设备的XIB吗?

Apple has really some solid documentation on how to use autolayout and build dynamically sizing screens using constraints. 苹果公司确实有一些可靠的文档 ,说明如何使用自动布局以及使用约束条件来动态调整屏幕尺寸。 Another solid tutorial to check out is this one from appcoda. 另一种固体教程检查出是一个从appcoda。 Can be a little confusing at first but once you understand constraints making screens that look nice for all screen sizes is actually pretty straightforward 刚开始时可能会有些混乱,但是一旦您了解了各种限制,就可以使所有屏幕尺寸的屏幕看起来都非常漂亮

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM