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