我希望将我的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];