[英]Autolayout + size classes: Possible to distinguish between different iPhone X and other devices?
[英]Size Classes to distinguish between iPhone 5, 6 and 6 Plus?
我很高兴得知Size Classes与iOS 7向后兼容(在某些情况下)。 现在我想知道 - 有没有办法使用Size Classes来区分iPhone 5,6和6 Plus?
实际上恰恰相反,大小类用于抽象设备。 这些是当前使用的大小类:
紧凑的宽度,紧凑的高度:3.5英寸,4英寸,4.7英寸横向模式的iPhone
紧凑的宽度,常规高度:所有目前可用的纵向iPhone
常规宽度,紧凑高度:5.5“iPhone in Landscape
常规宽度,常规高度:所有当前可用的iPad,无论方向如何
您可以尝试对屏幕高度(或宽度)进行测试,例如:
//iphone 5
if UIScreen.main.bounds.size.height == 568.0 {
// your code here
}
iphone屏幕高度如下:
iphone 5 = 568.0
iPhone 6 / 6s / 7 = 667.0
iphone 6/7 plus = 736.0
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.