启动时确定 iPad 方向
为什么当我在 iPad 模拟器中使用 didLoad 或 willAppear 中的以下方法时,设备总是认为其处于横向模式,而实际上它处于纵向模式。
UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
NSLog(@"orientation - %i", UIInterfaceOrientationIsPortrait(orientation));
这在 iPhone 模拟器中工作得很好,还有其他方法可以找出设备方向吗?
我尝试在 app.plist 中添加支持的方向,但模拟器仍然认为其处于横向模式?
干杯,
how come when i use the following method in didLoad or willAppear with the iPad simulator the device always thinks its in landscape mode when its clearly in portrait.
UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
NSLog(@"orientation - %i", UIInterfaceOrientationIsPortrait(orientation));
this works fine in the iPhone simulator, is there another way to find out the devices orientation?
I have tried adding the supported orientations in the app.plist, but still the simulator thinks its in landscape mode?
Cheers,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
UIDeviceOrientation 不是一回事作为 UIInterfaceOrientation。
尝试使用类似
[[UIApplication sharedApplication] statusBarOrientation]
的内容。UIDeviceOrientation is not the same thing as UIInterfaceOrientation.
Try something like
[[UIApplication sharedApplication] statusBarOrientation]
instead.