使用容器视图时无法隐藏选项卡栏 [英] can't make tab bar hidden when using container views

查看:82
本文介绍了使用容器视图时无法隐藏选项卡栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用使用每个包含2个容器视图的视图控制器作为选项卡栏控制器和导航控制器之间的中介.这是为了管理嵌入在每个中介中的一个容器视图中的菜单.

My app uses view controllers each containing 2 container views as intermediaries between a tab bar controller and navigation controllers. This is for the purpose of managing a menu that is embedded in one of the container views in each intermediary.

我需要隐藏标签栏(又名底部栏).

I need to hide the tab bar (aka bottom bar).

我尝试将setHidesBottomBarWhenPushed:YES发送到每个视图控制器,并且尝试为每个VC在情节提要中选择在推送时隐藏底栏".

I have tried sending setHidesBottomBarWhenPushed:YES to every view controller, and I have tried selecting "hides bottom bar on push" in the storyboard for every VC.

这些东西为什么不起作用?我认为这一定与我的体系结构有关:

Why aren't these things working? I assume it must be something about my architecture:

如您所见,导航控制器被嵌入到容器视图中,容器视图的VC链接到了标签栏控制器.

As you can see, the navigation controllers are embedded within container views whose VCs are linked to the tab bar controller.

在这种情况下如何隐藏标签栏?

How can I hide the tab bar in this situation?

推荐答案

setHidesBottomBarWhenPushed:与可以添加到导航控制器(而不是标签栏)的可选工具栏有关.我认为,如果您添加以下行self.tabBarController.tabBar.hidden = YES;到每个标签(带有容器视图的标签)中的初始控制器,它将隐藏标签栏.我认为,尽管如此,它将在选项卡栏的底部保留一个空间.我不确定解决此问题的最佳方法是什么.也许,如果您要隐藏选项卡栏,则根本不应该使用选项卡栏控制器.

setHidesBottomBarWhenPushed: has to do with the optional toolbar that can be added to a navigation controller, not the tab bar. I think that if you add the line self.tabBarController.tabBar.hidden = YES; to the initial controller in each tab (the one with the container view), it will hide the tab bar. I think though, that it will leave a space at the bottom where the tab bar was. I'm not sure what the best way to fix that would be. Perhaps, if you're hiding the tab bar, you shouldn't be using a tab bar controller at all.

这篇关于使用容器视图时无法隐藏选项卡栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆