【发布时间】:2020-09-12 05:08:57
【问题描述】:
我有一个 UINavigationController 包含一个 UIViewController。 UIViewController 就像一个菜单。所以我想通过点击我的 UIViewController 中的一个按钮来展示一个 UITabBarController。
但是在我的 UITabBarController 中,我需要为每个 ViewController 提供一个自己的 UINavigationController 本身。通过这样做:
viewControllers = [UINavigationController(rootViewController: myVc()), ...]
对于我的 UITabBarController,我最终在我的 TableView 顶部有一个奇怪的导航栏(它在我的 ViewController 内部,由我的 TabBarController 呈现)+ Xcode 控制台中的一些警告:new observer <UINavigationController: 0x7fd87d846a00>, removing old observer <UINavigationController: 0x7fd87f02ba00>
导航栏如下所示:
所以问题是,我在另一个 UINavigationController 中添加了一个 UINavigationController(如果我删除了第二个 UINavigationController,一切都按预期工作)。不幸的是,我的 TabBarController 中的每个 (Table)ViewController 都需要一个自己的 UINavigationController,因为在第一个 (Table)ViewController 中,我将附加一个 UISearchController,如果我将此 UISearchController 附加到包含我的 TabBar 的 NavigationController,那么每个 ViewController TabBar 内部会得到这个 SearchController。
我该如何解决这个问题?
感谢您的每一次帮助!
【问题讨论】:
-
向我们展示您迄今为止所做的尝试。 stackoverflow.com/help/how-to-ask
标签: ios swift uinavigationcontroller uisearchcontroller