模态UINavigationController – 我不能停止旋转

我正在使用故事板,我有一个UITabBarControllerembeddedUINavigationController。 我推一个视图控制器,然后从这个视图控制器我提出了一个UIViewController MODAL UINavigationController。

问题是,模态视图控制器可以旋转时,我的视图之前的模态视图不能。 如何阻止Modal导航控制器允许任何旋转?

我曾尝试添加:

-(NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskPortrait; } 

 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return (interfaceOrientation == UIInterfaceOrientationPortrait); } 

谢谢

尝试分类UINavigationController

 @implementation UINavigationController (Rotation_IOS6) -(BOOL)shouldAutorotate { return [[self.viewControllers lastObject] shouldAutorotate]; } -(NSUInteger)supportedInterfaceOrientations { return [[self.viewControllers lastObject] supportedInterfaceOrientations]; } - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { return [[self.viewControllers lastObject] preferredInterfaceOrientationForPresentation]; }