我的应用程序有一个视图控制器层次结构设置如下:
UIViewController
|
UITabBarController
|
UINavigationController
| |
| UIViewController (*)
|
UINavigationController
|
UIViewController (*)
为什么我的UIViewController(*)没有得到(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration方法?
当我的应用程序具有如下设置的视图控制器层次结构时:
UITabBarController
|
UINavigationController
| |
| UIViewController (*)
|
UINavigationController
|
UIViewController (*)
UIViewController(*)get(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration方法 .
2 回答
这是视图控制器包含问题 . 如果您的目标是iOS 5,则可以使用new UIViewController methods for containment(请参阅管理子视图控制器) . 否则,您需要将旋转消息从根
UIViewController
转发到UITabBarViewController
.UITabBarController中的所有UIViewControllers都应支持自动旋转,以允许UITabBarController的旋转 . 将此代码放在所有
UIViewController (*)
中: