如何切换到标签栏控制器? Theres 2在选项卡上查看带有导航控制器和标签栏控制器上的导航控制器的控制器。
let storyboard = UIStoryboard(name: "PendingOverview", bundle: nil)
let vc = storyboard.instantiateViewController(withIdentifier: "PendingOverviewVC") as! PendingOverViewController
let nc = UINavigationController(rootViewController: vc)
self.present(nc, animated: false, completion: nil)
谢谢
答案 0 :(得分:4)
在Storyboard
设置标识符UITabbarController
,然后使用instantiateViewController
显示UITabbarController
。
let storyboard = UIStoryboard(name: "PendingOverview", bundle: nil)
let tabbarVC = storyboard.instantiateViewController(withIdentifier: "TabbarIdentifier") as! UITabbarController
if let vcs = tabbarVC.viewControllers,
let nc = vcs.first as? UINavigationController,
let pendingOverVC = nc.topViewController as? PendingOverViewController {
pendingOverVC.pendingResult = pendingResult
}
self.present(tabbarVC, animated: false, completion: nil)