横向模式下的选项卡栏控制器
我的所有应用程序都处于横向模式。在某些时候,我切换到带有选项卡栏控制器的屏幕,但它的放置方式就像纵向模式一样。我对 UITabBarController 进行了子类化并重写方法“shouldAutorotateToInterfaceOrientation”以始终返回 YES,但因为该应用程序是已经在风景中,这个方法没有被调用。 无论如何有答案吗? 谢谢 贾尔德
All my app is in landscape mode .In some point I switch to a screen with Tab Bar Controller , but it's been placed like in portrait mode.I subclassed the UITabBarController and override the method "shouldAutorotateToInterfaceOrientation" to return YES always but because the app is already in landscape , this method is not being called.
does anyway have an answer to this?
thanks
Giald
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您不必继承 UITabBarController 的子类。如果所有子视图都支持横向,选项卡栏将自动旋转为横向。只要确保所有选项卡都支持横向方向,据我所知应该没问题。
You shouldn't have to subclass UITabBarController. The tab bar will autorotate to landscape, if all it's subviews support landscape. Just make sure all tabs support landscape orientation and you should be fine afaik.
Rengers 是对的,只需确保所有选项卡视图在各自的 shouldAutoRotateToInterfaceOrientation 覆盖中都有 YES 即可。根据您设置应用程序的方式,检查是否有任何父视图具有 shouldAutoRotateToInterfaceOrientation 覆盖。如果是这样,可能值得将它们注释掉并仅保留选项卡视图的覆盖。
Rengers is right, just make sure all tab views have YES in their respective shouldAutoRotateToInterfaceOrientation overrides. Depending on how you setup your app, check if any parent views have the shouldAutoRotateToInterfaceOrientation overrides. If so, it might be worthwhile commenting them out and leaving the overrides for the tab views only.