In iOS 8 they have added device orientation detection for UIInterfaceOrientationUnknown
(Check the pre-release documentation here)
UIInterfaceOrientationUnknown
The orientation of the device cannot be determined.
Available in iOS 8.0 and later.
typedef enum : NSInteger {
UIInterfaceOrientationUnknown = UIDeviceOrientationUnknown,
UIInterfaceOrientationPortrait = UIDeviceOrientationPortrait,
UIInterfaceOrientationPortraitUpsideDown = UIDeviceOrientationPortraitUpsideDown,
UIInterfaceOrientationLandscapeLeft = UIDeviceOrientationLandscapeRight,
UIInterfaceOrientationLandscapeRight = UIDeviceOrientationLandscapeLeft
} UIInterfaceOrientation;
The way I see it there are only 4 ways the device could possibly ever been Portrait
, UpsideDown
, LandscapeRight
and LandscapeLeft
. So in what circumstances would you ever have a device orientation of unknown?
I have faced the UIInterfaceOrientationUnknown
state when window creation was performed before UIApplication
prepared and called applicationDidLaunch
on appDelegate.
BTW, It was achieved by some swizzling magic inside the Typhoon DI framework.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With