微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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];

原文地址:https://www.jb51.cc/iOS/331473.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐