Size クラスを使用して、異なるレイアウトで iPad の横画面と縦画面をデザインする方法。両方の向きで w-regular と h-regular しか見つかりませんでした。例: Size Class を使用して、2 つのビューを縦方向に垂直に、横方向に水平に配置する必要があります。
16299 次
4 に答える
6
最後に解決策を見つけました:
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
}
}
于 2015-01-15T21:40:22.100 に答える