ユニバーサル アプリケーションを実装しています。私のアプリケーションでは、iPhone ではなく iPad の画面を自動回転する必要があります。どうやってやるの?次のコードで試しましたが、うまくいきません。
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return NO;
}
ユニバーサル アプリケーションを実装しています。私のアプリケーションでは、iPhone ではなく iPad の画面を自動回転する必要があります。どうやってやるの?次のコードで試しましたが、うまくいきません。
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return NO;
}
shouldAutorotate
UIViewControllerとメソッドで設定するのに苦労した後 supportedInterfaceOrientation
、iOS6 で成功しなかったため、最も効果的なのはアプリ デリゲートで設定することであることがわかりました。
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
return UIInterfaceOrientationMaskPortrait;
}
ただし、戻るUIInterfaceOrientationMaskPortraitUpsideDown
とアプリがクラッシュしていました。何を間違えたのかわからない!
最後に、plist ファイルのプロパティを変更して作成しました。