似乎当我的应用加载时,它不知道它的当前方向:
UIInterfaceOrientation orientation = [[UIDevice currentDevice] orientation];
if (orientation == UIDeviceOrientationPortrait) {
NSLog(@"portrait");// only works after a rotation, not on loading app
}
Run Code Online (Sandbox Code Playgroud)
一旦我旋转设备,我得到一个正确的方向,但当我加载应用程序,而不改变方向,似乎使用[[UIDevice currentDevice] orientation]
不知道当前的方向.
我第一次加载应用程序时是否还有另一种检查方法?