我有这样的 Storyboard文件:enter image description here
当用户登录时,我使用以下命令进行segue:
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let initialVC: UITabBarController = storyboard.instantiateViewController(withIdentifier: "loggedin") as! UITabBarController
self.present(initialVC, animated: true, completion: nil)
并自动打开带有标识符“selectsaloon”的 View Controller ,但有时根据条件我需要转到带有标识符“searchparams”的 View Controller 。帮我找到解决办法
最佳答案
当条件发生时,您可以在 viewdidload 上为 selectsaloon
进行导航
if (condition) {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let initialVC: UIVieWController = storyboard.instantiateViewController(withIdentifier: "searchparams") as! UIViewController
self.navigationController.push(initialVC, animated: true)
}
关于swift - 通过 TabbarController 和 NavigationController 进行导航。如何?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50448756/