【问题标题】:how to hide tab bar in the view controller that embedded in the navigation stack in swift?如何快速隐藏嵌入在导航堆栈中的视图控制器中的选项卡栏?
【发布时间】:2018-05-04 05:48:34
【问题描述】:

我在第二个标签栏(标签栏索引:1)中有一个 InvoiceVC,如上图所示。如果点击表格视图单元格,我需要转到 InvoiceDetailVC,如下图所示

正如您在 InvoiceDetailVC 中看到的,InvoiceDetailVC 底部没有标签栏,我的意思是底部有红色徽章的标签。我需要删除那个标签栏。

我尝试过使用 present modal 代替 push show segue。但问题是,没有返回 InvoiceVC 的返回按钮

那我该怎么办?

【问题讨论】:

  • 在您的目标控制器属性检查器中,选中该框在推送时隐藏底栏。

标签: ios swift uinavigationcontroller uitabbarcontroller


【解决方案1】:

在推入时在prepareforsegue 中使用并将hidesBottomBarWhenPushed 设置为true 以隐藏目标视图控制器上的标签栏。

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
    if (segue.identifier == "InvoiceVC") {
        let indexPath: IndexPath? = tableView.indexPathForSelectedRow
        let destViewController = segue.destination as? InvoiceVC
        destViewController?.recipeName = recipes[indexPath?.row ?? 0]
        destViewController?.hidesBottomBarWhenPushed = true
    }
}

【讨论】:

    猜你喜欢
    • 2018-07-13
    • 1970-01-01
    • 2011-04-03
    • 2011-01-07
    • 1970-01-01
    • 2018-04-19
    • 2018-08-04
    • 2016-02-21
    • 2015-03-24
    相关资源
    最近更新 更多