2012-11-28 40 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; 
}