关于如何隐藏UITabbar的问题

关于如何隐藏UITabbar的问题,曾经困扰过很多人。

1,设为Hidden, 这种方法虽然将TabBar隐藏掉,但是下面是一片空白,没有起到隐藏的实际功效

2,设置tabbar.frame = CGRectMake(0,480+);既将tabbar的frame 降低到屏幕一下。 这种方法也不行。

其实iphone SDK里面有一个参数,可以直接隐藏掉UITabBar:

1
2
3
4
5
6
7
<div class="cnblogs_Highlighter"><pre class="objc">UIViewCtrlTest* testCtrl = [[UIViewCtrlTest alloc] initW];
            threeModalView.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:testCtrl animated:YES];
                        threeModalView.hidesBottomBarWhenPushed = NO;//马上设置回NO
            [testCtrl release];
</pre>
</div>

不过使用该参数,虽然可以成功隐藏TabBar,但是popup回来的时候,有可能Tababr没有再出现, 既用户一旦隐藏,就无法重现了。

这个问题,有人建议在viewWillAppear 和 viewWillDisAppear里面设置

1
hidesBottomBarWhenPushed为TRUE 和 FALSE。
1
<br>
1
我自己的做法是:
1
2
3
4
5
6
7
8
<div class="cnblogs_Highlighter"><pre class="objc">                       UIViewCtrlTest* testCtrl = [[UIViewCtrlTest alloc] initW];
            testCtrl.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:testCtrl animated:YES];
                        testCtrl.hidesBottomBarWhenPushed = NO;//马上设置回NO
            [testCtrl release];
</pre>
</div>
<br>

转载自:  http://www.cnblogs.com/moshengren/archive/2010/10/18/1855202.html

 
原文地址:https://www.cnblogs.com/Cheetah-yang/p/4642958.html