无法确定设备的当前方向

发布于 2024-12-09 11:06:06 字数 138 浏览 0 评论 0原文

我遇到的问题是 [UIDevice currentDevice].orientation 在某些情况下返回 0。根据我的理解,这永远不应该发生。

它甚至不在启动时。我现在是否必须创建自己的实例变量来跟踪每次旋转并存储它?

I have a problem that [UIDevice currentDevice].orientation returns 0 in some cases. 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

祁梦 2024-12-16 11:06:07

我遇到了同样的问题,然后遇到了这篇文章:

不要依赖 UIDevice 方向进行旋转

我希望有所帮助。

I was having the same issue, and then came across this article:

Don't Rely On UIDevice Orientation For Rotation

I hope that helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文