2012-11-28 42 views
1

我目前正在开发与iOS 5的和iOS 6 工作我的大部分意见只在除1iOS 6的定位与NavigationController

RotationNavigationController肖像方向的应用程序:主要UINavigationController重写supportedInterfaceOrientationshouldAutorotate

PageViewController:推入RotationNavigationController并仅以纵向方向显示。

ImageViewController:推送PageViewController后。与UIInterfaceOrientationMaskAllButUpsideDown一起显示。

下面是我在ImageViewControllerViewDidLoad

- (void)viewDidLoad 
{ 
    // currentMask is the value returned by supportedInterfaceOrientation 
    [(RotationNavigationController*)self.navigationController setCurrentMask:UIInterfaceOrientationMaskAllButUpsideDown]; 
    [(RotationNavigationController*)self.navigationController setShouldAutorotate:YES]; 
} 

当我在景观popViewController从ImageViewController,我回到PageViewController在横向模式过于而PageViewController只支持纵向。

当然,我将ImageViewController的viewWillDisappear中的遮罩重置为肖像。

有没有办法让PageViewController保持纵向?

+1

这在http讨论了(似乎​​平凡):// stackoverflow.com/questions/12640870/ios-6-force-device-orientation-to-landscape – emrys57

回答

0

感谢您的链接emrys57。我找到了解决办法那里,它是在年底相当简单:

在RotationNavigationController,只需添加下面的方法:

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation 
{ 
    return UIInterfaceOrientationPortrait; 
}