1

私のプログラムは横向きモードのみを使用します。以前は xcode 4.5 を使用していましたが、現在は動作していません。現在は xcode 5 を使用しています。

私は左右の風景だけが必要です。

私のアプリデリゲートに入れました

 - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return UIInterfaceOrientationLandscapeLeft;//|UIInterfaceOrientationLandscapeRight;
}

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


-(NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskLandscape;
}

- (BOOL)shouldAutorotate{
    if([[UIDevice currentDevice] orientation] == UIInterfaceOrientationLandscapeLeft ||[[UIDevice currentDevice] orientation] == UIInterfaceOrientationLandscapeRight)
    {
        return YES;
    }
    else{
        return NO;
    }
}

私が入れたすべてのviewcontrollerに

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}

ここに画像の説明を入力

すべてのストーリーボードビューコントローラーとナビゲーションビューコントローラーは、このようにセットアップします。 ここに画像の説明を入力 どうすればこの問題を解決できますか

4

1 に答える 1