2012-01-23 14 views
0

私のアプリは、このように設定するビューコントローラの階層があります。回転ビューコントローラ - >タブバーコントローラ - >ナビゲーションコントローラ - >ビューコントローラ

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

なぜ私のUIViewController(*)を(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)durationメソッド? (UIInterfaceOrientation)toInterfaceOrientation時間:(NSTimeInterval)デュレーション方法

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

のUIViewController(*)(無効)willAnimateRotationToInterfaceOrientationを取得:私のアプリはこのように設定するビューコントローラの階層があり

答えて

3

これは、ビューコントローラの封じ込めの問題です。 iOS 5をターゲットにしている場合は、new UIViewController methods for containmentを使用できます(子ビューコントローラの管理を参照)。それ以外の場合は、ローテーションメッセージをルートUIViewControllerからUITabBarViewControllerに転送する必要があります。

+0

"ルートUIViewControllerからUITabBarViewControllerにローテーションメッセージを転送する必要があります。 - これを行う方法? – rowwingman

+0

ルート 'UIViewController'に' willRotateToInterfaceOrientation: '(および必要に応じて他のローテーションコールバック)をオーバーライドし、' [self.tabBarController willRotateToInterfaceOrientation:] 'を呼び出します。これは、あなたのルート 'UIViewController'が提示している' UITabBarController'への参照を保持していると仮定しています。 –

1

UITabBarController内のすべてのUIViewControllerは、UITabBarControllerの回転を許可するために自動回転をサポートする必要があります。すべてUIViewController (*)にこのコードを配置します。

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

UIViewController(*)があります。 – rowwingman

関連する問題