相关疑难解决方法(0)

iOS:加载时的设备方向

似乎当我的应用加载时,它不知道它的当前方向:

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]不知道当前的方向.

我第一次加载应用程序时是否还有另一种检查方法?

iphone uidevice uiinterfaceorientation ios

52
推荐指数
2
解决办法
5万
查看次数

标签 统计

ios ×1

iphone ×1

uidevice ×1

uiinterfaceorientation ×1