Search code examples
iosios8uiinterfaceorientation

UIViewController interfaceOrientation Property Deprecated


I am currently utilizing the interfaceProperty of my UIViewController that as of iOS 8 has been deprecated.

@property(nonatomic,readonly) UIInterfaceOrientation interfaceOrientation NS_DEPRECATED_IOS(2_0,8_0);

I am using said property for determining where the physical Home button is orientated for accelerometer and gravity vector corrections. UIDeviceOrientation is not a suitable replacement because these corrections are actually applied to the user interface.

I have searched for suitable refactoring advice, however, they do not apply to my use of the property.


Solution

  • You can try using

    UIApplication.sharedApplication().statusBarOrientation

    It will return a UIInterfaceOrientation value which you can use to get the interface orientation of the device.