【问题标题】:Dismissing embedded UITabbbar/storyboard in swift 3在 swift 3 中关闭嵌入式 UITabbbar/storyboard
【发布时间】:2018-11-06 20:46:06
【问题描述】:

我正在尝试使用在我的 UIApplication 窗口中嵌入 Storyboard 或 Tabbar 控制器的社交网络框架 (CometChat)。现在,当我完成与嵌入式视图的交互时,我需要一种方法来关闭它。我在窗口中添加了一个按钮来调用下面的方法来关闭嵌入的

func dismiss() {
 let rootvc = UIApplication.shared.keyWindow?.rootViewController
    for v in (rootvc?.view.subviews)! {
        v.isHidden = true
    }
}

嵌入视图后面的每个视图似乎都消失了,但嵌入视图没有。Screenshot of calling above method

尝试遍历所有窗口并在窗口中隐藏视图,仍然没有成功

let windows = UIApplication.shared.windows
    for window in windows {
        window.rootViewController?.view.isHidden = true
    }

请帮忙,我已经用了大约 4 天了。在此先感谢。

【问题讨论】:

标签: ios swift xcode storyboard tabbarcontroller


【解决方案1】:

由于您正在展示 Embedded ViewController,因此您需要使用 popviewcontroller 然后将其关闭。请参考以下代码:

navigationController?.popViewController(animated: true)

dismiss(animated: true, completion: nil)

这应该可以解决您面临的问题,您将能够在您的应用中关闭 EmbeddedViewController。

【讨论】:

  • 您也可以下载我们最新版本的SDK;我们添加了一个关闭按钮选项。
猜你喜欢
  • 2016-02-09
  • 1970-01-01
  • 1970-01-01
  • 2011-03-14
  • 2017-02-21
  • 1970-01-01
  • 2020-04-16
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多