2012-10-03 20 views
5

iOS 6の新しい方向付け方法を使用していますが、うまくいきます。私のビューはポートレートモードで表示されています。私はpresentviewcotrnollerを使用してそれをランドスケープに回転させると、そのビューコントローラを却下して向きを元に戻します。それは風景にとどまらなければならないが、それは肖像画になります。 ここに私のコードです。ios6ランドスケープモードからポートレートモードへの回転の問題

- (NSUInteger)supportedInterfaceOrientations { 
    return UIInterfaceOrientationMaskAll; 

} 

// Tell the system It should autorotate 
- (BOOL) shouldAutorotate { 
    return YES; 
} 

// Tell the system which initial orientation we want to have 
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { 
    return UIInterfaceOrientationMaskPortrait; 
} 

私はそれが理由preferredInterfaceOrientationForPresentation方法で起こったが、this.Pleaseヘルプのためのソリューションを取得していないと思います!

ありがとうございます!

+0

正確な問題は何ですか? preferredInterfaceOrientationのポートレートのみを設定しました。したがって、コントローラはポートレートモードで常に表示する必要があります。 UIInterfaceOrientationMaskAllを試して、何が起こるかを確認してください。 – mayuur

+0

キャッチされていない例外 'UIApplicationInvalidInterfaceOrientation'のためにアプリを終了しています。理由: 'preferredInterfaceOrientationForPresentationはサポートされているインターフェイスの向きを返す必要があります!'それは – iProgrammer

+2

私の悪い墜落した。 UIInterfaceOrientationを受け入れ、マスクではありません。 Btw、このメソッドを削除する作品!とにかく使用は何ですか? – mayuur

答えて

6

すべてのinterfaceOrientationsが最初にサポートされるようにするには、preferredInterfaceOrientationForPresentationメソッドを作成しないでください。これは、常に好ましいInterfaceの向きになります。

+0

感謝 – iProgrammer

関連する問題