3

iOS用のプロジェクトにXcode4.4を使用していて、画面の1つを永続的に横向きにしたかったので、

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

Xcode4.5とiOS6.0にアップデートしてからはまったく機能しなかったので、新しい機能を使用する必要があることがわかりました。

- (NSUInteger)supportedInterfaceOrientations {
        return UIInterfaceOrientationMaskLandscapeRight; 
}

- (BOOL)shouldAutorotate {
        return YES;
}

これで画面は横向きになりましたが、画面が縦向きモードのままであるように、ステータスバーはその場所に残ります。

修正方法がわかりません。

ありがとうございました。

4

1 に答える 1

1

これをviewWillAppear関数に実装し、iOS6で機能しました。

[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:YES];

于 2012-10-17T20:35:42.757 に答える