Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIInterfaceOrientationUnknown for what purpose

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?

like image 521
Popeye Avatar asked Nov 22 '22 19:11

Popeye


1 Answers

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.

like image 89
Zapko Avatar answered Nov 25 '22 09:11

Zapko