繁体   English   中英

如何快速隐藏嵌入在导航堆栈中的视图控制器中的选项卡栏?

[英]how to hide tab bar in the view controller that embedded in the navigation stack in swift?

在此处输入图片说明

我在第二个标签栏(标签栏索引:1)中有一个InvoiceVC,如上图所示。 如果点击了表格视图单元格,我需要像下面的图片一样选择InvoiceDetailVC

在此处输入图片说明

正如您在InvoiceDetailVC中看到的那样,InvoiceDetailVC的底部没有选项卡栏,我的意思是该选项卡的底部带有红色标志。 我需要删除该标签栏。

我尝试以模态形式使用present而不是push show segue。 但是问题是,没有返回按钮可以返回到InvoiceVC

所以我该怎么做 ?

在此处输入图片说明

使用在prepareforsegue同时推动并设置hidesBottomBarWhenPushed为true,以隐藏目标视图控制器上的TabBar。

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
    }
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM