Jes*_*ock 0 uiinterfaceorientation ios ios8
我目前正在使用UIViewController 的interfaceProperty ,该属性从 iOS 8 开始已被弃用。
@property(nonatomic,readonly) UIInterfaceOrientation interfaceOrientation NS_DEPRECATED_IOS(2_0,8_0);
Run Code Online (Sandbox Code Playgroud)
我使用所述属性来确定物理主页按钮的方向,以进行加速度计和重力矢量校正。UIDeviceOrientation 不是合适的替代品,因为这些更正实际上应用于用户界面。
我已经寻找了合适的重构建议,但是,它们不适用于我对该属性的使用。
您可以尝试使用
UIApplication.sharedApplication().statusBarOrientation
它将返回一个UIInterfaceOrientation值,您可以使用该值来获取设备的界面方向。