如何隐藏UITabBar 已经如何使已经隐藏的TabBar重现(原创)

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

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

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

 

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

 

UIViewCtrlTest* testCtrl = [[UIViewCtrlTest alloc] initW];
			threeModalView.hidesBottomBarWhenPushed = YES;
			[self.navigationController pushViewController:testCtrl animated:YES];
                        threeModalView.hidesBottomBarWhenPushed = NO;//马上设置回NO
			[testCtrl release];

 

 

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

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

hidesBottomBarWhenPushed为TRUE 和 FALSE。

我自己的做法是:
                       UIViewCtrlTest* testCtrl = [[UIViewCtrlTest alloc] initW];
			testCtrl.hidesBottomBarWhenPushed = YES;
			[self.navigationController pushViewController:testCtrl animated:YES];
                        testCtrl.hidesBottomBarWhenPushed = NO;//马上设置回NO
			[testCtrl release];

posted @ 2010-10-18 23:54  苏瑞强  阅读(5596)  评论(3编辑  收藏  举报