how to hide tabbar while pressing tab bar item?
In my application tab bar controller is used to show more than one views.I want to hide the Tab bar at the time of pressing first tab bar item.
But,I don't kno开发者_开发技巧w how to do this...Plz help me to do this...
Thank You, Renya
There are two methods in the tab bar control delegate protocol you should try:
– tabBarController:shouldSelectViewController:
– tabBarController:didSelectViewController:
You can hide the tab bar by calling calling tabBarController.controller.hidden = YES
in the implementation of one these methods.
Note that the tab bar controller has two views; the tab bar and another view that contains the main content. I expect that you'll want to resize this content view too:
//remove the tab bars and resize the main view to fill the screen
UITabBar *tabBar = tabBarController.tabBar;
tabBar.hidden = YES;
UIView *mainView;
for (UIView * possibleMainView in [self.view subviews])
{
if (![possibleMainView isKindOfClass:[UITabBar class]])
{
mainView = possibleMainView;
break;
}
}
CGRect mainViewFrame = mainView.frame;
mainViewFrame.size.height += tabBar.frame.size.height;
mainViewFrame.origin.y = 0;
mainView.frame = mainViewFrame;
精彩评论