gpt4 book ai didi

ios - 实例化 View Controller Swift 3 标签栏 Controller

转载 作者:搜寻专家 更新时间:2023-10-30 23:05:10 26 4
gpt4 key购买 nike

如何切换到标签栏 Controller ?在带有导航 Controller 的选项卡上有 2 个 View Controller ,在选项卡栏 Controller 上有一个导航 Controller 。

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)

谢谢

最佳答案

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)

关于ios - 实例化 View Controller Swift 3 标签栏 Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42593088/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com