私のプログラムは横向きモードのみを使用します。以前は 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);
}
すべてのストーリーボードビューコントローラーとナビゲーションビューコントローラーは、このようにセットアップします。
どうすればこの問題を解決できますか