1

ルートと詳細の2つのビューコントローラーがあります。ルートビューコントローラは横向きと縦向きをサポートしているため、次のコードがあります。

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
        return (interfaceOrientation == UIInterfaceOrientationPortrait
        || interfaceOrientation == UIInterfaceOrientationLandscapeLeft
        || interfaceOrientation == UIInterfaceOrientationLandscapeRight
        || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown);
    }

上記のコードは、ルートビューコントローラーに対して完全に機能します。

ルートビューコントローラーが表示されていて、ユーザーがデバイスを横向きモードに回転させると、それに応じてビューが調整されます。この時点から、詳細ビューコントローラをスタックにプッシュすると、ランドスケープモードでロードされます。しかし、ポートレートモードのみをサポートするように構成しているので、そうすべきではありません。詳細ビューコントローラーで以下のコードを使用しています。

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

1 に答える 1

0

2番目のViewControllerで、コードを...に置き換えます。

return UIInterfaceOrientationIsPortrait( interfaceOrientation );
于 2011-02-16T15:29:23.567 に答える