gpt4 book ai didi

swift - 如何使用标签栏 Controller 呈现导航 Controller

转载 作者:行者123 更新时间:2023-11-28 14:24:04 24 4
gpt4 key购买 nike

我有导航 Controller 和标签栏 Controller 。 TBC 嵌入在 NC 中。当我从另一个 VC 介绍 VC 时,我在那里只看到 NC 而不是 TBC。我希望他们都被展示。我该怎么办?

这是我的代码:

let mainAreaVC = self.storyboard?.instantiateViewController(withIdentifier: "MainAreaVC") as! MainAreaVC
let mainAreaVCe = UINavigationController(rootViewController: mainAreaVC)
self.present(mainAreaVCe, animated: true, completion: nil)

enter image description here

最佳答案

如果你想用 NavigationControllerTabBarcontroller 显示 MainAreaVC 那么你需要显示 UITabBarController MainAreaVC。所以在 Storyboard中为你的 TabBarController 设置 Storyboard IdTabbarVC 或任何你想要的然后使用它机智 instantiateViewController 获取 UITabBarController

let tabbarVC = self.storyboard?.instantiateViewController(withIdentifier: "TabbarVC") as! UITabBarController
self.present(tabbarVC, animated: true, completion: nil)

关于swift - 如何使用标签栏 Controller 呈现导航 Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51740284/

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