隐藏UITabBar? [英] Hide UITabBar?
问题描述
在我的应用程序中,我有一个标签栏。在一些视图中,我也有一个工具栏。所以当我使用工具栏来查看这些视图时,它看起来很丑陋 - 在视图底部有两个栏。我认为这将是一个最佳的解决方案,隐藏标签栏时,进入这些特定的意见。
但是我只是不知道如何以正确的方式做。我试图将UITabBarController的tabBar隐藏属性设置为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,而不是UITabBarController。
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屋!