如何使用 Size 类设计具有不同布局的 iPad 横向和纵向屏幕。 对于两个方向,我只能找到 w-regular 和 h-regular。示例:我需要使用 Size Class 纵向对齐 2 个 View ,横向对齐 2 个 View
最佳答案
终于找到了解决办法:
if traitCollection.verticalSizeClass == .Regular && traitCollection.horizontalSizeClass == .Regular {
var orientation:UIInterfaceOrientation = UIApplication.sharedApplication().statusBarOrientation;
if orientation == UIInterfaceOrientation.LandscapeLeft || orientation == UIInterfaceOrientation.LandscapeRight {
// orientation is landscape
} else {
// orientation is portrait
}
}
关于ios - iPad Landscape 和 Portrait 具有 Size Class 的不同布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27700440/