【发布时间】:2013-04-11 22:10:46
【问题描述】:
我的这个设置在我的大多数视图控制器中只支持横向
我的应用委托有这段代码:
-(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
NSUInteger orientations = UIInterfaceOrientationMaskLandscape;
if (self.window.rootViewController) {
UIViewController * pressented = [[((UINavigationController *)self.window.rootViewController) viewControllers] lastObject];
orientations =[pressented supportedInterfaceOrientations];
}
return orientations;
}
在大多数视图控制器中:
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}
当我推动这个控制器(我想旋转的那个)时,我的问题出现了:
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskALL;
}
它完美地旋转,但是当我弹出视图控制器(点击导航栏的后退按钮)且方向为纵向时,呈现的视图控制器也将其方向设置为纵向。
如何使呈现的视图控制器保持锁定在横向上,或者在弹出之前强制有问题的控制器旋转回横向。
【问题讨论】:
标签: objective-c ios6 orientation