【问题标题】:Presenting Modal ViewController from (Table)ViewController inside a NavigationController inside a TabBarController在 TabBarController 内的 NavigationController 内从 (Table)ViewController 呈现模态 ViewController
【发布时间】:2016-11-14 00:48:04
【问题描述】:

当我尝试直接从表格视图控制器(也可以是普通视图控制器)呈现模态控制器时,它出现在选项卡栏后面并且看起来很丑,因为我正在对其使用模糊效果。我正在使用导航控制器,因为我需要在顶部有一个栏,并且经过研究,发现这是最好的方法。

我发现这样做:

self.parent?.parent?.present(ModelViewController(), animated: true, completion: nil)

当想要展示模态控制器时。但是,我想这不是很安全。这样做的正确方法是什么?

【问题讨论】:

    标签: ios cocoa-touch uinavigationcontroller uitabbarcontroller modalviewcontroller


    【解决方案1】:

    为了让 ModalViewController 出现在标签栏的前面,它的 modalPresentationStyle 必须设置为 overFullScreen。因此,例如在初始化 ModalViewController 时:

    self.modalPresentationStyle = .overFullScreen(Swift 3 语法)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-10-22
      • 2018-03-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-07-03
      • 1970-01-01
      • 2020-01-25
      相关资源
      最近更新 更多