iOS 8 引入了可在 Storyboard 和 Xibs 中使用的新屏幕类型,我可以在代码中检测到这些类型吗?如果是,怎么办?
在这里您可以找到更多相关信息https://developer.apple.com/library/content/releasenotes/General/WhatsNewIniOS/Articles/iOS8.html https://developer.apple.com/library/content/releasenotes/General/WhatsNewIniOS/Articles/iOS8.html
是的,你可以,UIViewControllers 现在有一个traitCollection
属性,其中包含从设备习惯用法到当前大小类别等的信息...此外,您可以实现该方法func traitCollectionDidChange(previousTraitCollection: UITraitCollection)
当尺寸类别(或任何特征)发生变化时(如用户在 iPhone 上旋转设备时)收到通知。您正在寻找的 UITraitCollection 的属性是horizontalSizeClass
and verticalSizeClass
..这里有一个参考 https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITraitCollection_ClassReference/
希望有帮助
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)