私はいくつかの調査をしましたが、私のnavigationControllerのrootViewControllerを起動時に正しいものにする答えが見つからないようです。私の元の質問はここにあった:launch orientation of iPad is incorrect for landscape orientation (upside down)。UIViewControllerの向きを強制的に
私のinfo.plistでは、両方向の向きをサポートするように設定しました。私のrootViewControllerを次のように変更した場合:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// return UIInterfaceOrientationIsLandscape(interfaceOrientation); // original that does not work
return YES;
}
私のアプリは正しい向きで始まります。しかし、私はポートレートモードをサポートしたくありません。私は風景モードをサポートしたいだけです。
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
if (UIInterfaceOrientationIsPortrait(toInterfaceOrientation)) {
UIDeviceOrientation orientation = UIInterfaceOrientationLandscapeLeft;
[UIApplication sharedApplication].statusBarOrientation = orientation;
}
else {
}
をしかし、これはポートレートモードに回転させられるからアプリを防ぐことはできません:私はオリエンテーションを強制し、このような何かを行うことによって、ポートレートモードに切り替えられることがないようにと考えていました。方向を強制することは可能ですか?スタートアップの向きが正しいようにするために何か必要なことはありますか(ランドスケープモードのみ)?ありがとう!
私はAppDelegateでUINavigationControllerを使用しているので、それはまったく問題なのでしょうか? – Crystal
UINavigationControllerで使用する他のすべてのView Controllerが同じshouldAutorotateポリシーを持っている限り、問題はありません。 – bandejapaisa
ええ、私はまだ問題が発生しています。私のアプリケーションが最初に起動するとき、私はモーダルフォームと要件ごとにUIAlertViewを表示する必要があります。基本的には、tvcは私のviewControllerです。私はモーダルで表示します: 'tvc.modalPresentationStyle = UIModalPresentationFormSheet; tvc.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; [self presentModalViewController:tvc animated:YES]; '。このViewControllerはUIInterfaceOrientationIsLandscape(interfaceOrientation)を返すようにshouldAutoRotateを設定しています。このビューコントローラは、それを正しく起動させることができませんでしたか? – Crystal