我有一个实现的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右上角的屏幕外出现了一半。有任何想法吗?

最佳答案

在ModalViewController中,以与mainViewController中相同的方式实现shouldAutorotateToInterfaceOrientation(两者都需要就其支持的方向达成一致)。

关于ipad - 使用UIModalPresentationFormSheet的模态视图出现在屏幕外,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/4272718/

10-09 07:43