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

dou*_*dou 7 ios

我希望将我的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.
Run Code Online (Sandbox Code Playgroud)

NWC*_*der 0

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

就像是:

[self.modalViewController setModalPresentationStyle:UIModalPresentationFullScreen];
Run Code Online (Sandbox Code Playgroud)

而不是:

[nav setModalPresentationStyle:UIModalPresentationFullScreen]; 
Run Code Online (Sandbox Code Playgroud)