iOS 6 SDK でこの問題が発生しています。回転を許可する必要のあるビュー (ビデオビューなど) とそうでないビューがあります。これで、アプリの Info.plist ですべての向きを確認し、各 ViewController で何が起こるかを整理する必要があることがわかりました。しかし、それはうまくいきません!アプリは常に Info.plist で指定された方向に回転します。
Info.plist:
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
回転を許可しない ViewController:
//deprecated
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
- (NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskPortrait;
}
観察: アプリは横向きと縦向きに回転します。なぜ、または私が間違っているのか、何か考えはありますか?
乾杯、マーク
編集: 私の最新の調査結果は、アプリのある時点で回転させたい場合は、プロジェクト設定または Info.plist で 4 つの回転方向すべてを有効にする必要があることも示しています。これに代わる方法は、オーバーライドすることです
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
Info.plist をオーバーライドする AppDelegate で。Info.plist で Portrait のみを設定してから、shouldAutorotateToInterfaceOrientation または supportedInterfaceOrientations をオーバーライドして一部の ViewController で回転させることはできなくなりました。