[英]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.