【发布时间】:2018-07-19 01:23:10
【问题描述】:
您好,我有带有 5 个元素的标签栏控制器。当我按下最后一个按钮时,有一堆按钮需要显示另一个视图控制器,然后当我第二次按下该选项卡栏按钮时,它需要恢复其第一个条件(一堆按钮),它就像一个导航器。我尝试使用以下代码:
let destinationVC = self.storyboard?.instantiateViewController(withIdentifier: "third") as? ThirdVC
self.tabBarController?.present(destinationVC!, animated: true, completion: nil)
但是,视图控制器出现在一个新屏幕中,而我的标签栏控制器不见了。如何在标签栏控制器上方打开我的视图控制器?有可能吗?
【问题讨论】:
-
试试
self.tabBarController?.navigationController?.present(destinationVC!, animated: true, completion: nil) -
不,它对我不起作用,我需要在标签栏内添加导航控制器吗?
-
要么你可以简单地改变tabBarcontroller的当前vc
tabBarController.addChildViewController(vc)
标签: ios swift uinavigationcontroller uitabbarcontroller