1

iOS6用のアプリがあります。アプリが電話で実行されている場合は、縦向きのみをサポートしたいと考えています。タブレットの場合は、すべての向きをサポートしたいと考えています。これでうまくいくと思いました(ビューコントローラーで):

- (NSUInteger)supportedInterfaceOrientations
{
    if ([Util isPhoneFormFactor]) {
        return UIInterfaceOrientationPortrait;
    }

    return UIInterfaceOrientationMaskAll;
}

しかし、これは私のiPhoneシミュレーターの起動時に例外をスローします:

*** Terminating app due to uncaught exception 
'UIApplicationInvalidInterfaceOrientation', reason: 
'Supported orientations has no common orientation with 
 the application, and shouldAutorotate is returning YES'

これは、以下をオーバーライドして NO を返さなければならないことを意味すると解釈しました。

- (BOOL) shouldAutorotate
{
    return NO; 
}

これで例外は修正されましたが、iPad シミュレーターで回転すると回転しなくなりました。これを行う正しい方法は何ですか?

ありがとう

4

1 に答える 1