我有一个非常标准的视图层次结构,主要是UITabBarController
包含几个UINavigationController
s。
我正在创建一个新的UINavigationController
并从其中一个选项卡中以模态方式呈现它。
我希望它与 一起显示UIModalPresentationCurrentContext
,所以我将其设置为:
[newNavCon setModalPresentationStyle:UIModalPresentationCurrentContext];
然后,我这样呈现:
[oldNavCon presentViewController:newNavCon animated:YES completion:nil];
但是当它出现时,它是全屏的,而不是我设置的当前上下文。
当我查看断点时,模式表示样式 onnewNavCon
更改为UIModalPresentationFullScreen
立即 after presentViewController
。
真正让我困惑的是,这种行为只发生在 iOS7 上。它在 iOS 8-10 上完全符合预期。
为什么会这样?在 iOS7 上是否有一些我不知道的特定怪癖?为什么演示风格会像这样被覆盖?
编辑:为了澄清,这是我正在使用的视图层次结构:
UIViewController
(作为容器,全屏)UITabBarController
(不是全屏,由容器控制)definesPresentationContext
UINavigationController
(作为标签根,显示模式窗口)definesPresentationContext
UINavigationController
(由上述模态呈现UIViewController
)modalPresentationStyle
=UIModalPresentationCurrentContext
UIViewController