0

我有一个非常标准的视图层次结构,主要是UITabBarController包含几个UINavigationControllers。

我正在创建一个新的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
4

1 回答 1

0

我猜您正在 iPhone 设备或模拟器上进行测试。在 iOS 7 及之前的版本中,UIModalPresentationCurrentContext这是一项仅限 iPad 的功能。

于 2017-01-30T06:43:26.640 回答