iPhone Dev - 自动旋转所有视图
(顺便说一句,我开发时没有使用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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在您使用的每个视图控制器中的 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?
如果视图控制器未加载,它将无法响应自动旋转消息。 因此,在视图控制器中,当从笔尖加载它时,它应该检查方向并根据需要调整大小和移动内容。
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.