swift - 通过 TabbarController 和 NavigationController 进行导航。如何?

标签 swift uinavigationcontroller uitabbarcontroller

我有这样的 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/

相关文章:

ios - 具有大标题的 UISearchController 在选项卡栏中崩溃并显示 "Only one palette with a top boundary edge can be active outside of a transition"

arrays - 尝试将对象数组保存到 UserDefaults

ios - 当键仅检索 1 个对象时如何向对象添加数据? PARSE.COM swift

ios - 自定义 UIToolBar 的正确方法是什么?

swift - 导航栏内容不显示

ios - 更改 UITabBarController 中选项卡的顺序

ios - 共享核心数据——我错过了什么?

ios - ScrollBar 在手动滚动时添加垂直偏移

ios - presentModalViewController 与 pushviewcontroller 内存消耗

ios - 单击 UIBar 按钮时删除 TabBar Controller