2011-06-24 8 views
0

RootViewControllerインスタンスがランドスケープモードで開始するiPhoneアプリがあります。それはカメラをサポートするので、写真を撮るためにポートレートモードに変わります。終了するとRootViewControllerインスタンスに戻りますが、方向はランドスケープに変わりません。私はこれを自動的に横向きにシフトしたいと思う。Xcodeは自動的にポートレートからランドスケープに戻ることはできません

私はRootViewControllerまたはCameraViewControllerviewWillDisapperviewWillAppear方法で

[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO] 

を追加しようとしたが、方向は変更されません。プログラムで向きを変更するにはどうすればよいですか?

答えて

0

コントローラで次の方法を実装してみてください。

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

希望します。

+0

申し訳ありませんが、動作していません – user631607

関連する問題