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

8

我想将我的 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.
3个回答

1
这对我来说仍然是一个问题,因为在iOS 7应用程序中,我得出结论:在转换发生后更改modalPresentationStyle没有任何效果。

今天仍然同意。 - Mike

0

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

类似于:

[self.modalViewController setModalPresentationStyle:UIModalPresentationFullScreen];

而不是:

[nav setModalPresentationStyle:UIModalPresentationFullScreen]; 

1
这将完全没有任何影响。 - jyavenard

0

我认为,你可以尝试将modalpresentationStyle更改为UIModalPresentationPageSheet

[nav setModalPresentationStyle:UIModalPresentationPageSheet];

这个类型应该自动旋转您的模态视图


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接