我有这个设置来支持我的大多数视图控制器中的横向方向
我的应用程序委托有这段代码:
-(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;
}
它完美地旋转但是当我以纵向方向弹出视图控制器(点击导航栏的后退按钮)时,呈现的视图控制器也将其方向设置为纵向。
如何使呈现的视图控制器保持锁定在横向上,或强制有问题的控制器在弹出之前旋转回横向。