简体   繁体   English

无法确定设备的当前方向

[英]Not able to determine current orientation of device

I have a problem that [UIDevice currentDevice].orientation returns 0 in some cases. 我有一个问题,在某些情况下[UIDevice currentDevice].orientation返回0。 In my understanding this should never happen. 以我的理解,这永远不会发生。

It's not even at startup. 甚至不是在启动时。 Do I now have to create my own instance variable that keeps track of every rotation and stores it? 现在是否需要创建自己的实例变量来跟踪每个旋转并进行存储?

I was having the same issue, and then came across this article: 我遇到了同样的问题,然后遇到了这篇文章:

Don't Rely On UIDevice Orientation For Rotation 不要依靠UIDevice Orientation进行旋转

I hope that helps. 希望对您有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM