如何使用标签栏控制器显示导航控制器

时间:2018-08-08 06:54:21

标签: swift uinavigationcontroller uitabbarcontroller

我有导航控制器和标签栏控制器。 TBC嵌入在NC中。当我从另一个VC呈现VC时,在那只能看到NC,而没有看到TBC。我希望他们都被介绍。我该怎么办?

这是我的代码:

let mainAreaVC = self.storyboard?.instantiateViewController(withIdentifier: "MainAreaVC") as! MainAreaVC
let mainAreaVCe = UINavigationController(rootViewController: mainAreaVC)
self.present(mainAreaVCe, animated: true, completion: nil)

enter image description here

1 个答案:

答案 0 :(得分:1)

如果要同时显示MainAreaVCNavigationController的{​​{1}},则需要显示TabBarcontroller而不是UITabBarController。因此,在情节提要中,将MainAreaVC的{​​{1}}设置为Storyboard Id之类的内容,或者将其与TabBarController一起使用,以获取TabbarVC

instantiateViewController
相关问题