如何隐藏UITAbBar? [英] How to hide UITabBar?
问题描述
在我的应用中,我有一个标签栏。在某些视图中,我还有一个工具栏。因此,当我使用工具栏进入这些视图时,它看起来很丑-视图底部有两个条。我认为这是进入这些特定视图时隐藏标签栏的最佳解决方案。
但是我只是想不出正确的方法。我试图将UITabBarController的tabBar hidden属性设置为YES,但是它不起作用。而且我也尝试着以我的观点做以下事情:
In my app I have a tab bar. And in some views I as well have a toolbar. So when I come to those views with a toolbar it looks ugly - two bars at the bottom of the view. I thought that it would be a best solution to hide a tab bar when entering those particular views. But I just couldn't figure out how to do it in a right way. I tried to set UITabBarController's tabBar hidden property to YES, but it didn't work. And I as well tried to do the following thing in whatever view I am:
self.hidesBottomBarWhenPushed = YES;
但是效果不佳。
对于这种情况正确的解决方案是什么?我不想在任何视图上都有2个小节。
What is the right solution to this situation? I don't want to have 2 bars at any view.
推荐答案
您必须使用将hidesBottomBarWhenPushed属性设置为YES
You have to use set the hidesBottomBarWhenPushed property to YES on the controller that you are pushing and NOT to the UITabBarController.
otherController.hidesBottomBarWhenPushed = YES;
[navigationController pushViewController: otherController animated: TRUE];
或者您可以在首次初始化要推送的控制器时设置属性。
Or you can set the property when you first initialize the controller you want to push.
这篇关于如何隐藏UITAbBar?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!