且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

了解 IOS8 大小类

更新时间:2023-02-03 09:52:14

Apple 的设计让您无需考虑特定设备.这个想法是您使用自动布局,以便每个屏幕自动调整到可用空间.Size classes 是它的扩展,因此当您获得大量额外空间时,您可以做一些稍微不同的事情.

Apple have designed it so that you don't have to think about specific devices. The idea is that you use auto layout so that each screen automatically adjusts to the available space. Size classes is an extension of that so when you get a lot of extra space you can do something slightly different.

如果您想针对特定设备自定义布局,您可以.和你描述的差不多.然而,当 Apple 明年发布 iPad Pro 和 4.3" iPod touch 时会发生什么(你首先在这里阅读了它)?通常,不需要硬编码间距和大小;你的界面应该缩放以使用可用空间,这就是自动布局和大小类为您提供的.

If you want to customise your layout to specific devices, you can. Pretty much as you describe it. However, what happens next year when Apple release the iPad Pro and a 4.3" iPod touch (you read about it here first)? In general, there is no need to hard code spacing and sizes; your interface should scale to use the space available, and that's what auto layout and size classes give you.

将其视为约束条件而不是已知屏幕尺寸列表当然更难,但这应该是值得的.

It's certainly harder to think it terms of constraints rather than a list of known screen sizes, but it should be worth it.