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