【问题标题】:Using both TabBarController and NavigationController同时使用 TabBarController 和 NavigationController
【发布时间】:2020-08-16 18:27:59
【问题描述】:

这是我的故事板:

这就是我想要实现的目标:

我的故事板正确吗?有没有办法只为两个视图使用一个 NavigationController?谢谢!

【问题讨论】:

  • 你的故事板已经够好了...而且你需要使用两个导航控制器
  • 好的,谢谢!
  • 它工作得好吗?或者你有什么问题?

标签: ios objective-c swift xcode


【解决方案1】:

您可以将 UITabBarController 嵌入到 UINavigationController 中,并将这两个 UIViewControllers 都放入一个 UITabBarController 中,而 UINavigationController 则位于一个 UINavigationController 中。虽然情节提要不允许您将 UITabBarController 嵌入到 UINavigationController 中。但是您可以通过编程方式实现此结果。这是一个例子:

let tabbarController = TabBarController()
window?.rootViewController = UINavigationController(rootViewController: tabBarController)

【讨论】:

  • 是什么原因?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-01-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-10-22
  • 1970-01-01
相关资源
最近更新 更多