如何在根视图 ChildViewController 中隐藏 TabBar
How to hide TabBar in RootView ChildViewControllers
我在 TabBar 项 ChildViewControllers
中隐藏 UITabBarController
时遇到麻烦
例如假设我们在我的主屏幕中有两个标签栏项目并且选择了第一个标签栏项目并且我想导航第一个标签栏然后我想在第一个 TabBar 项 childViewControllers
中隐藏 TabBar
我找到了这个
的解决方案
[self.tabBarController.tabBar setHidden:YES];
使用隐藏 属性 在 viewDidLoad 中使用隐藏标签栏项目。
Select 在 StoryBoard 中的 Opaque Bars 选项下 ViewController。
在推送或显示视图之前。将检查 viewcontroll 上的 hidesBottomBarWhenPushed 变量并自动隐藏底栏。您可以通过两种方式使用它:
1- 在子控制器中覆盖它:
override var hidesBottomBarWhenPushed: Bool {
return true
}
2-你可以在执行segue之前设置它以准备segue:
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "identifier" {
segue.destination.hidesBottomBarWhenPushed = true
}
}
我在 TabBar 项 ChildViewControllers
UITabBarController
时遇到麻烦
例如假设我们在我的主屏幕中有两个标签栏项目并且选择了第一个标签栏项目并且我想导航第一个标签栏然后我想在第一个 TabBar 项 childViewControllers
我找到了这个
的解决方案 [self.tabBarController.tabBar setHidden:YES];
使用隐藏 属性 在 viewDidLoad 中使用隐藏标签栏项目。 Select 在 StoryBoard 中的 Opaque Bars 选项下 ViewController。
在推送或显示视图之前。将检查 viewcontroll 上的 hidesBottomBarWhenPushed 变量并自动隐藏底栏。您可以通过两种方式使用它:
1- 在子控制器中覆盖它:
override var hidesBottomBarWhenPushed: Bool {
return true
}
2-你可以在执行segue之前设置它以准备segue:
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "identifier" {
segue.destination.hidesBottomBarWhenPushed = true
}
}