首页 > 解决方案 > 如何在子 ViewController 上 segue 后显示 UITabBar?

问题描述

我有 4 个 mainViewController连接到UITabBarController. 这些是我的应用程序的 4 个主屏幕。这 4 个屏幕中的每一个屏幕上都有一个图标TabBar

现在,在这些主屏幕之一中,我希望能够单击一个按钮来显示一个新的“子”视图控制器。当我从MainVC转到 theChildVC,时,UITabBar不会显示在ChildVC. 我怎样才能得到UITabBar保持显示?我不想添加ChildVCUITabBar,因为它不应该在栏上有图标。

我愿意使用任何类型的 segue 或视图组合。

在 内MainVC,我想单击一个按钮来显示而不会ChildVC丢失(并且不添加为图标)。UITTabBarMainVCChildVCUITabBar

标签: swiftxcodeuitabbarcontrollerseguechildviewcontroller

解决方案


如果我正确理解了您的问题的假设,您应该将所有 4 个“主屏幕”堆叠到单独的导航堆栈 (UINavigationController) 中。

所以结果将是:

UITabBarController -> UINavigationController -> UIViewController (1 of those main screens) click button -> Desired UIViewController

看看这个:https ://stackoverflow.com/a/27425271/8290785


推荐阅读