1

iPad アプリにモーダル ビューを追加しようとしています。すべてのビューは横向きモードになっているはずです。スタイルには、フォームまたはページ シートを選択しました。

これが問題です。次のコードを使用してモーダル ビューをビューに追加すると:

TempController *tmpViewController = [[TempController alloc] initWithNibName:@"TempView" bundle:nil];
tmpViewController.modalPresentationStyle = UIModalPresentationPageSheet;
[self presentModalViewController:tmpViewController animated:YES];

私のモーダル ビューは横向きモードで表示されますが、その下のビューは縦向きで表示されます。モーダルが閉じられた後、ビューはまだポートレイトのままです。ビューにモーダルをアタッチしないと、ビューは横向きモードで正常に表示されます。

statusBarOrientation と shouldAutootateToInterfaceOrientation で遊んでみましたが、まだ運がありません。Mountain Lion で xcode 4.4.1 を実行しています

更新: これは私の shouldAutorotateToInterfaceOrientation です:

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

1 に答える 1

0

簡単な注意:presentModalViewController:animated:は非推奨です。Apple は を使用することをお勧めしpresentViewController:animated:completion:ます。

質問を確実に理解するために、モーダルView Controllerを表示するView Controllerは横向きモードで正しく表示されますが、モーダルを表示するとすぐに縦向きモードに変わりますが、モーダルView Controllerも横向きで正しく表示されます? これは iPhone/iPod touch または iPad で発生していますか? ビュー コントローラを提示するshouldAutoRotateToInterfaceOrientationメソッドのコードはどのようになりますか?

于 2012-08-23T02:09:03.603 に答える