【发布时间】:2018-05-10 01:27:22
【问题描述】:
我有一个连接到 3 个 UINavigationControllers 的 UITabBarController。它们中的每一个都有一个 UIViewController 作为根视图控制器。当我单击其中一个 ViewController (VC1) 中的按钮时,我希望它与新的 ViewController (VC2) 保持一致。很简单。
在运行期间,当 segue 发生并出现 VC2 时,导航栏消失。
导航栏出现在storyBoard/interface builder中,segue是类型:present(Push)。
VC1 中的代码:
@IBAction func create_clicked(_ sender: Any) {
performSegue(withIdentifier: "segueIdentifier", sender: self)
}
了解 UITabBarController tabBar 是如何实例化的可能会有所帮助:
func login() {
let storyBoard = UIStoryBoard(name: "Main", bundle: nil)
let tabBar = storyBoard.instantiateViewController(withIdentifier: "tabBar")
window?.rootViewController = tabBar
}
请帮忙。
【问题讨论】:
-
你用的是什么类型的segue?
-
当前(推)segue
-
VC2 的 Storyboard 中是否显示导航栏?
-
是的:导航栏确实显示在 VC2 的情节提要中
-
"present (Push)" 这没有意义。
present和push是相反的。是哪个????
标签: ios swift xcode uinavigationcontroller uitabbarcontroller