简体   繁体   English

在视图控制器->标签栏控制器->导航控制器->视图控制器的层次结构内旋转视图控制器

[英]Rotating view controllers within a hierarchy of View Controller -> Tab Bar Controller -> Navigation Controller -> View Controller

My app has a view controller hierarchy set up like this: 我的应用程序具有如下设置的视图控制器层次结构:

UIViewController
    |
UITabBarController
    |
    UINavigationController
    |  |
    |  UIViewController (*)
    |
    UINavigationController
       |
       UIViewController (*)

Why my UIViewController (*) don't get (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration method? 为什么我的UIViewController(*)没有得到(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)到InterfaceOrientation持续时间:(NSTimeInterval)duration方法?

When my app has a view controller hierarchy set up like this: 当我的应用程序具有如下设置的视图控制器层次结构时:

UITabBarController
    |
    UINavigationController
    |  |
    |  UIViewController (*)
    |
    UINavigationController
       |
       UIViewController (*)

UIViewController (*) get (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration method. UIViewController(*)获取(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation持续时间:(NSTimeInterval)duration方法。

This is a view controller containment issue. 这是一个视图控制器包含问题。 If you're targeting iOS 5, you can use the new UIViewController methods for containment (see Managing Child View Controllers ). 如果您的目标是iOS 5,则可以使用新的UIViewController方法进行遏制 (请参阅管理子视图控制器 )。 Otherwise, you need to forward the rotation messages from your root UIViewController to the UITabBarViewController . 否则,您需要将旋转消息从您的根UIViewController转发到UITabBarViewController

All your UIViewControllers inside UITabBarController should support autorotation in order to allow rotation for UITabBarController. UITabBarController内的所有UIViewControllers应该支持自动旋转,以便允许UITabBarController旋转。 Place this code in all UIViewController (*) : 将此代码放在所有UIViewController (*)

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
   return YES;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在选项卡栏控制器 - >导航控制器 - >视图控制器的层次结构内旋转视图控制器 - Rotating view controllers within a hierarchy of Tab Bar Controller -> Navigation Controller -> View Controller 如何防止标签栏控制器中的视图控制器旋转? - How to prevent the view controllers in a tab bar controller from rotating? 重置标签栏控制器的视图控制器 - Resetting Tab bar controller's view controllers 选项卡栏控制器位于导航控制器内,或共享导航根视图 - Tab bar controller inside a navigation controller, or sharing a navigation root view 带选项卡栏的导航控制器仅在第一视图 - Navigation Controller with Tab Bar only on first view 具有导航控制器的视图控制器 - View controller with a navigation controller 在标签栏控制器中具有导航控制器(作为主视图) - Having a Navigation Controller (as the main view) inside a tab bar controller 在标签栏控制器/导航控制器上方添加自定义视图? - Adding custom view above tab bar controller/navigation controller? 在带有导航控制器的基于标签栏的应用程序上添加视图控制器? - Add view controller over tab bar based application with navigation controller? 检查View Controllers的选项卡栏成员是我的View Controller吗? - Checking View Controllers' tab bar member is my view controller?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM