iPhone Dev - 自动旋转所有视图

发布于 2024-08-02 01:26:22 字数 278 浏览 1 评论 0原文

(顺便说一句,我开发时没有使用Interface Builder) 如果您有一个自动旋转的选项卡栏应用程序,因此设置了所有自动调整大小蒙版,那么如何使其适用于所有视图? 就像如果一个视图自动旋转到横向,您在选项卡栏中选择一个不同的选项卡,然后与该选项卡关联的视图出现,并且一切都混乱了,因为它从未自动旋转,它被初始化为适合纵向的框架模式下,即使自动调整大小蒙版设置为使其在横向上看起来不错,但它从未旋转。 解决办法是什么? (顺便说一句,我延迟加载视图,因此在任何给定时间加载的唯一视图是与所选选项卡关联的视图(视图控制器的视图))。

(By the way I develop without Interface Builder)
If you have a tab bar app that autorotates, so all the autoresizing masks are set, how do you make it work with all the views? Like if one view autorotates to landscape, you select a different tab in the tab bar, and the view associated with that tab comes up, and its all messed because it never got autorotated, it got initialized with the frame that makes it fit in portrait mode, even though the autoresizingmasks are set to have it look fine in landscape, it never got rotated. Whats the solution? (By the way, I'm lazy loading the views, so the only view loaded at any given time is the view(view controller's view) associated with the selected tab).

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

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

发布评论

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

评论(2

岁月静好 2024-08-09 01:26:22

在您使用的每个视图控制器中的 didrotatefrominterfaceorientation 方法中声明所有必需的方向是否可以解决问题?

例如,带有选项卡栏的主视图称为“mainView”,当您选择一个选项卡时,它会加载一个名为“firstView”的视图,“firstView”视图控制器是否设置了方向?

Does declaring all the required orientations in the didrotatefrominterfaceorientation method in every view controller you are using fix the problem?

e.g. your main view, with the tab bar is called "mainView", and when you choose a tab, it loads a view called "firstView", does the "firstView" view controller have the orientations set?

拥抱没勇气 2024-08-09 01:26:22

如果视图控制器未加载,它将无法响应自动旋转消息。 因此,在视图控制器中,当从笔尖加载它时,它应该检查方向并根据需要调整大小和移动内容。

If a view controller is not loaded, it won't be able to respond to autorotation messages. So in your view controller, when it's loaded from the nib, it should check the orientation and resize and move things as necessary.

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