3

私は実装するUIViewControllerを持っています

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

次に、そのビューの上にモーダルをポップアップしようとします。

ModalViewController *modalViewController = [[ModalViewController alloc] init];
modalViewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
modalViewController.modalPresentationStyle = UIModalPresentationFormSheet;
[mainViewController presentModalViewController:modalViewController animated:YES]; 

iPadが縦向きのときにモーダルを起動すると、正常に動作します。しかし、私がそれを横向きに持ってモーダルを起動しようとすると、モーダルはiPadの右上の画面の半分に表示されます。何か案は?

4

1 に答える 1

4

ModalViewController では、mainViewControllershouldAutorotateToInterfaceOrientationと同じ方法で実装します (両方がサポートする方向について合意する必要があります)。

于 2010-11-25T04:27:57.297 に答える