Pop*_*eye 5 objective-c device-orientation ios8
在 iOS 8 中,他们添加了设备方向检测UIInterfaceOrientationUnknown
(在此处查看预发布文档)
UIInterfaceOrientationUnknown
无法确定设备的方向。
在 iOS 8.0 及更高版本中可用。
typedef enum : NSInteger {
UIInterfaceOrientationUnknown = UIDeviceOrientationUnknown,
UIInterfaceOrientationPortrait = UIDeviceOrientationPortrait,
UIInterfaceOrientationPortraitUpsideDown = UIDeviceOrientationPortraitUpsideDown,
UIInterfaceOrientationLandscapeLeft = UIDeviceOrientationLandscapeRight,
UIInterfaceOrientationLandscapeRight = UIDeviceOrientationLandscapeLeft
} UIInterfaceOrientation;
Run Code Online (Sandbox Code Playgroud)
我看到它的方式,只有4种方式的装置可能可能去过Portrait
,UpsideDown
,LandscapeRight
和LandscapeLeft
。那么在什么情况下你会遇到未知的设备方向?
我遇到过在准备好并调用appDelegateUIInterfaceOrientationUnknown
之前执行窗口创建时的状态。UIApplication
applicationDidLaunch
顺便说一句,它是通过 Typhoon DI 框架内的一些 swizzling 魔法实现的。