既然 UIViewController
中的 interfaceOrientation
属性已弃用,那么检测当前设备方向的推荐方法是什么?
最佳答案
您可以使用[UIApplication sharedApplication].statusBarOrientation
请注意 [[UIDevice currentDevice] orientation]
与您的应用程序旋转不完全。文档:
Discussion: The value of the property is a constant that indicates the current orientation of the device. This value represents the physical orientation of the device and may be different from the current orientation of your application’s user interface. See UIDeviceOrientation for descriptions of the possible values.
我会检查 statusBarOrientation 是否有效。
关于ios - 如何知道 iOS 8 中的当前 interfaceOrientation?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27966880/