2011-12-22 3 views
0

iPhoneアプリケーションを開発中で、アプリケーションは横長モードでのみ動作するはずです。しかし、デバイスやシミュレータを回転させると、viewContollerのモードが横から縦に変化します。デバイスまたはシミュレータはポートレイトですが、viewControllerをランドスケープモードに維持します。どうすればこのことが起こるのですか?前もって感謝します。ポートレートモードを無効にする

答えて

1

オーバーライドあなたのビューコントローラでは、この方法:

// Override to allow orientations other than the default portrait orientation. 
-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{ 
    // Return YES for supported orientation, NO for other; 
} 
+0

を設定info_plistの変化... OPは、彼がこれだけYESが助けにはなりません戻って、ポートレートモードのサポートを望んでいないと述べています。 –

+0

明らかに...私は、彼が上書きしなければならない方法を指摘しました。私は完全なコードを書いていない... – rockeye

+0

はい私は知っているが、それは本当に明確ではなかった –

-1

オーバーライドすべてのViewControllersでこの方法:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 
    // Return YES for supported orientations 
    return (interfaceOrientation == UIInterfaceOrientationLandscapeRight || 
      interfaceOrientation == UIInterfaceOrientationLandscapeLeft); 

}

Only support for landscape Interface orientation

1

はこの追加を参照してくださいあなたのViewController.m

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

サポートされているインターフェイスの向きが唯一の風景

+0

私はこのセットを持っていますが、それは十分ではないようです。 –

関連する問題