ios – 如何在显示模态视图控制器时更改modalPresentationStyle?

我希望将我的UIModalPresentationFormSheet样式模式视图设置为UIModalPresentationFullScreen样式,但是当它已经显示为UIModalPresentationFormSheet样式时,它无法使用代码“[xx setModalPresentationStyle:UIModalPresentationFullScreen];”转到全屏模式.

显示模态视图后,有没有办法改变现在的风格?我的代码是这样的:

UITableDownload* vc = [[UITableDownload alloc] initWithStyle:UITableViewStylePlain];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc];
[nav setModalPresentationStyle:UIModalPresentationFormSheet];
[MainAppDelegate mainbrowserViewController] presentModalViewController:nav animated:YES];

...//after shown,sometime I implement following code:
[nav setModalPresentationStyle:UIModalPresentationFullScreen];//(The "nav" object is the same as above code)
//But the change style code takes no effect.

解决方法

不确定这是不是答案,但您是否尝试通过modalViewController访问控制器?

就像是:

[self.modalViewController setModalPresentationStyle:UIModalPresentationFullScreen];

而不是:

[nav setModalPresentationStyle:UIModalPresentationFullScreen];

相关文章

当我们远离最新的 iOS 16 更新版本时,我们听到了困扰 Apple...
欧版/美版 特别说一下,美版选错了 可能会永久丧失4G,不过只...
一般在接外包的时候, 通常第三方需要安装你的app进行测...
前言为了让更多的人永远记住12月13日,各大厂都在这一天将应...