处理选项卡控制器时仅以特定方式旋转某些视图

发布于 2024-12-12 12:44:51 字数 285 浏览 1 评论 0原文

我有一个带有许多 (4) 个不同视图的选项卡栏控制器。我希望能够仅将我的一个视图旋转到 landScapeRight 或 LandscapeLeft (因此没有纵向或颠倒)。其他的只能是纵向或倒置。我在某处读到,对于选项卡控制器,所有子视图都需要在方法 shouldAutoRotateToInterfaceOrientation 中返回 YES:我已经完成了此操作并且一切正常,但我似乎只能在全有或全无的情况下得到它,这意味着它们要么全部执行所有旋转或根本不旋转。 如果有人对如何解决这个问题有任何想法或建议,我们将不胜感激。

先感谢您!

I have a tab bar controller with many (4) different views. I want to be able to rotate only one of my views to landScapeRight or LandscapeLeft (so no portrait or upside down). The others should only be portrait or upside down. I read somewhere that for tab controllers, all subviews needed to return YES in the method shouldAutoRotateToInterfaceOrientation: I have done this and everything works but I can only seem to get it in an all-or-nothing situation, meaning its either all of them do all the rotations or none rotate at all.
If anyone has any ideas or suggestions on how to tackle this problem, it would be much appreciated.

Thank you in advance!

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

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

发布评论

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

评论(2

_失温 2024-12-19 12:44:52

编辑(我误读了你的问题):我认为你不能独立旋转子视图。

Edit (I had misread your question): I don't think you can rotate subviews independently.

迎风吟唱 2024-12-19 12:44:52

我假设您正在使用 UITabBarController 的子类来获取自动旋转行为。如果您想获得独立的旋转行为,则必须采用仿射变换路线。这有点痛苦,但可行。

I assume that you are using a subclass of UITabBarController to get the autorotation behavior. If you want to get independent rotation behavior, you'll have to go the affine transform route. It's kind of a pain, but doable.

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