2017-04-11 36 views
0

enter image description here我想以编程方式扩展到新的ViewController,但是当我做我的tabBar消失。TabBar在程序化阶段消失

if user == usernameStored && pass == passwordStored{ 
     print("Good") 
     let vc = self.storyboard?.instantiateViewController(withIdentifier: "home") 
     self.present(vc!, animated: true, completion: nil) 



    } 
+0

链接到标签栏视图控制器? –

+0

是其对main.storyboard – Johnd

+0

你能证明你的故事板图像? –

回答

1

从你的代码,这不是segue通过编程方式。你实际上是present a viewController无论你有什么。因此tabBarController是封面。

要在代码中使用segue,它应该是这样的。 - homeSegueID是您在故事板中创建segue时给出的identifier

performSegue(withIdentifier: "homeSegueID", sender: nil) 

如果你只是想以编程方式做到这一点不segue,你可以这样做,而不是。 (这个假设您目前ViewController处于UINavigationController堆栈。

navigationController?.pushViewController(vc, animated: true) 
1

导航控制器是否将视图控制器封装为标签栏控制器,还是只是将标签栏添加到视图控制器?这是你应该做的事情:

Tab Bar Controller