0
我没有使用iOS 10的物理设备来测试此功能,但在模拟器中运行iOS 10的任何设备上,该应用程序不会旋转,保持肖像。但是,在iOS 11中,它旋转得很好。在任何视图控制器(方向不在iOS 10中旋转,但在iOS 11中旋转
override var shouldAutorotate: Bool {
return true
}
override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
return UIInterfaceOrientationMask.allButUpsideDown
}
根或:所有取向框都在Info.plist中和是否我使用或省略(是的代码在与取向涉及整个应用程序的唯一位)检查否则),它在iOS 10中没有任何影响。该应用程序完全基于约束,并且存在导航控制器,我读过这些导航控制器可能会导致问题。但是,这些答案中提出的一切都不适合我。有些东西阻止了iOS 10中的应用旋转,我无法弄清楚。
此方法也返回没有在iOS版10(但在iOS的11件作品):
override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
if size.width > size.height {
print("orientation: \(UIDevice.current.orientation)")
} else {
print("orientation: \(UIDevice.current.orientation)")
}
}
我已经在应用程序中禁用的一切,仍然没有在iOS的10