xcode Swift - 如何从 ViewController 转到 TabBarController
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30419087/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Swift - How do I segue from ViewController to TabBarController
提问by davidgilman
How do I add a ViewController
before a TabBarController
in Swift? I am using Parse to make a custom login in the ViewController
which would lead to the TabBarController
... Help would be appreciated!
如何在 Swift 中在aViewController
之前添加 a TabBarController
?我正在使用 Parse 在其中进行自定义登录,ViewController
这将导致TabBarController
...帮助将不胜感激!
采纳答案by Chameleon
1.Control-drag from yellow symbol (ViewController) to the TabBarController
1.Control-drag 从黄色符号 (ViewController) 到TabBarController
This will create a segue in your ViewController
menu
这将在您的ViewController
菜单中创建一个 segue
2.Click this new segue "Show segue to Tab..." and in identity inspector set an identifier name.
2.点击这个新的segue“Show segue to Tab...”并在身份检查器中设置一个标识符名称。
3.Now when you want to make the segue happen, use call...
3.现在,当你想让 segue 发生时,使用 call...
performSegueWithIdentifier("WhatEveryYouNamedSegue", self)
回答by JustinvR
This is the way I transfer from the login view controller to my home view controller tab bar.
这是我从登录视图控制器转移到我的主视图控制器选项卡栏的方式。
let homeViewController = self.storyboard?.instantiateViewController(withIdentifier: "HomeVCTabBar") as? UITabBarController
self.view.window?.rootViewController = homeViewController
self.view.window?.makeKeyAndVisible()
The most common mistake people make is that they use Instead of UITabBarController the name of the VC they go to.
人们最常犯的错误是他们使用他们去的 VC 的名称而不是 UITabBarController 。
Make sure you use UITabBarController to entry the first view from your TabBarController.
确保使用 UITabBarController 从 TabBarController 进入第一个视图。