1

私は現在、iOS 5 および iOS 6 で動作するアプリケーションを開発しています。私のビューのほとんどは、1 つを除いて縦向きのみです。

RotationNavigationController :およびUINavigationControllerをオーバーライドするメイン。supportedInterfaceOrientationshouldAutorotate

PageViewController : RotationNavigationController にプッシュされ、縦向きでのみ表示されます。

ImageViewController : PageViewController の後にプッシュされます。で表示されUIInterfaceOrientationMaskAllButUpsideDownます。

ここに私が持っているものがありImageViewControllerますViewDidLoad

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

またpopViewController、横向きの ImageViewController から横向きの PageViewController に戻ると、横向きモードでも PageViewController に戻りますが、PageViewController は縦向きのみをサポートします。

もちろん、ImageViewController のマスクviewWillDisappearを Portrait にリセットします。

PageViewController を縦向きのままにする方法はありますか?

4

1 に答える 1

0

リンクemrys57をありがとう。私はそこに解決策を見つけました、そしてそれは最終的には非常に些細なことでした:

RotationNavigationController に、次のメソッドを追加するだけです。

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return UIInterfaceOrientationPortrait;
}
于 2012-11-30T13:49:36.627 に答える