有什么方法可以触发界面方向检查吗?

发布于 2024-09-03 14:42:31 字数 207 浏览 5 评论 0原文

我的应用程序将从反面视图(只有一个方向)转到主视图(可以有任何类型的方向)。当我从反面视图返回主视图时,不会立即检查和更改主视图的方向。

我需要一种方法触发 willRotateToInterfaceOrientation 中发生的内置方向检查,以便当用户从翻转视图转到主视图时方向正确。

我看到了有关此问题的另一个问题,但没有看到明确的答案,

谢谢!

My app is going from a flipside view (only one orientation) to its main view (can have any sort of orientation. When I go from flipside back to main view, the main view's orientation is not checked and changed immediately.

I need a way to trigger the built in orientation check that happens in willRotateToInterfaceOrientation so that the orientation is correct when the user goes from flipside view to main view. Any help is appreciated.

I saw another question about this but didn't see a definitive answer.

Thanks!

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

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

发布评论

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

评论(1

伴随着你 2024-09-10 14:42:31

不幸的是,当前的 iPhone 操作系统没有办法做到这一点。

主要原因是shouldAutorotateToInterfaceOrientation:的结果被缓存了,所以你不能在运行时改变它的结果。因此,如果您翻转到同一视图控制器中的另一个视图,无论您做什么,它都不会改变方向(或者会改变,但稍后会无法正常工作)。

我建议改用模态视图控制器。然后您将无法显示翻转动画(或不容易),但方向更改应该可以正常工作。

Unfortunately, there are no ways for that in current iPhone OS.

The main reason is that the result of shouldAutorotateToInterfaceOrientation: is cached, so you must not change its result runtime. So if you flip to another view in the same view controller, it won't change orientation no matter what you do (or it will, but will work improperly later).

I suggest using a modal view controller instead. You won't be able to show a flipping animation then (or not easily), but the orientation changes should work fine.

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