我有一个相当标准的视图层次结构,主要是一个包含多个UITabBarController的UINavigationController。
我正在创建一个新的UINavigationController,并在其中一个选项卡中以模式方式呈现它。
我希望它在UIModalPresentationCurrentContext中显示,所以我将其设置为:
[newNavCon setModalPresentationStyle:UIModalPresentationCurrentContext];然后,我把它呈现如下:
[oldNavCon presentViewController:newNavCon animated:YES completion:nil];但是当它出现时,它是全屏的,而不是我设置的当前上下文。
当我查看断点时,newNavCon上的模态表示样式将在presentViewController之后立即更改为UIModalPresentationFullScreen。
真正让我困惑的是,这种行为只发生在iOS7上。在iOS 8-10上,它的工作原理与预期完全一致。
为什么会发生这种情况?在iOS7上我不知道有什么特别的怪癖吗?为什么会像这样覆盖演示文稿样式?
编辑:为了澄清,下面是我正在使用的视图层次结构:
UIViewController (作为一个容器,全屏)UITabBarController (非全屏,由容器控制) definesPresentationContext
UINavigationController (作为选项卡根,显示模态窗口) definesPresentationContext
UINavigationController (由上述UIViewController以模式方式呈现) modalPresentationStyle = UIModalPresentationCurrentContext
UIViewController发布于 2017-01-30 06:43:26
我猜你是在iPhone设备或模拟器上进行测试。在iOS 7和之前的版本中,UIModalPresentationCurrentContext是iPad特有的功能。
https://stackoverflow.com/questions/41927959
复制相似问题