gpt4 book ai didi

ipad - 使用 UIModalPresentationFormSheet 的模态视图出现在屏幕外

转载 作者:行者123 更新时间:2023-12-01 13:03:46 26 4
gpt4 key购买 nike

我有一个 UIViewController 实现

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

然后,我尝试在该 View 之上弹出一个模式:
ModalViewController *modalViewController = [[ModalViewController alloc] init];
modalViewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
modalViewController.modalPresentationStyle = UIModalPresentationFormSheet;
[mainViewController presentModalViewController:modalViewController animated:YES];

如果我在 ipad 处于纵向时启动模态,它工作正常。但是当我把它放在横向并尝试启动模式时,模式出现在 ipad 右上角的一半屏幕外。有任何想法吗?

最佳答案

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

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

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com