Is it possible to hide it with animation ?
Asked
Active
Viewed 2.4k times
11
-
I put a variation on the solutions proposed below here: http://stackoverflow.com/questions/4031804/how-to-hide-tab-bar-programatically-and-then-expand-view-to-fit/15855340#15855340 – juggler Apr 06 '13 at 19:57
5 Answers
23
You should use this code:
self.tabBarController.tabBar.hidden=YES;

theDuncs
- 4,649
- 4
- 39
- 63

Pratik Patel
- 261
- 2
- 9
-
2It's leaving a black space for me in place of the tab bar... Not a good solution – Flupp Aug 06 '16 at 20:16
23
A UITabBar inherits from UIView, so you can hide it and animate it like you would with a standard UIView.
- (void) hideTheTabBarWithAnimation:(BOOL) withAnimation {
if (NO == withAnimation) {
[theTabBar setHidden:YES];
} else {
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDelegate:nil];
[UIView setAnimationDuration:0.75];
[theTabBar setAlpha:0.0];
[UIView commitAnimations];
}
}

Guillaume
- 21,685
- 6
- 63
- 95
-
2Although I haven't tested it myself, I believe this would just hide the view but still keep its frame there (hence new views would be impeded by this hidden frame). A better way is to use hidesBottomBarWhenPushed property on the *vc* that will be pushed – Ege Akpinar Feb 06 '13 at 11:00
-
The best answer for me. I am really a very happy. So we have to manager other thing. You solved my problem in second. Thanks a lot :) – Nirmalsinh Rathod Sep 05 '13 at 09:53
6
You can also hide it using the attributes inspector:
but not with an animation.

hanumanDev
- 6,592
- 11
- 82
- 146
3
-(void)hideTabBar
{ UITabBarController * tabbarcontroller= appDelegate.tabBarVC;
if (tabbarcontroller.tabBar.isHidden)
{
return;
}
tabbarcontroller.tabBar.hidden=YES;
CGRect frm=tabbarcontroller.view.frame;
frm.size.height += tabbarcontroller.tabBar.frame.size.height;
tabbarcontroller.view.frame=frm;
}
-(void)showTabBar
{ UITabBarController * tabbarcontroller=appDelegate.tabBarVC;
if (!tabbarcontroller.tabBar.isHidden)
{
return;
}
CGRect frm=tabbarcontroller.view.frame;
frm.size.height -= tabbarcontroller.tabBar.frame.size.height;
tabbarcontroller.view.frame=frm;
tabbarcontroller.tabBar.hidden=NO;
}
here appDelegate is = (AppDelegate *) [[UIApplication sharedApplication] delegate]
tabBarVc is UITabBarController *tabBarVC defined as property in app delegate
hope this helps

Tanuj Jagoori
- 309
- 3
- 9
0
Another Solution I use: Call Methods When You Want to Hide Menu:
//Show Tab Bar
[self showTabBar:self.tabBarController];
//If You Want to Hide/Show Navigation Bar Also
[self.navigationController setNavigationBarHidden: NO animated:YES];
//Hide Tab Bar
[self hideTabBar:self.tabBarController];
//If You Want to Hide/Show Navigation Bar Also
[self.navigationController setNavigationBarHidden: YES animated:YES];
Methods:
- (void)hideTabBar:(UITabBarController *) tabbarcontroller
{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];
for(UIView *view in tabbarcontroller.view.subviews)
{
if([view isKindOfClass:[UITabBar class]])
{
[view setFrame:CGRectMake(view.frame.origin.x, 480, view.frame.size.width,
view.frame.size.height)];
}
else
{
[view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y,
view.frame.size.width, 480)];
}
}
[UIView commitAnimations];
}
- (void)showTabBar:(UITabBarController *) tabbarcontroller
{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];
for(UIView *view in tabbarcontroller.view.subviews)
{
if([view isKindOfClass:[UITabBar class]])
{
[view setFrame:CGRectMake(view.frame.origin.x, 431, view.frame.size.width,
view.frame.size.height)];
}
else
{
[view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y,
view.frame.size.width, 431)];
}
}
[UIView commitAnimations];
}

mikemike396
- 2,435
- 1
- 26
- 41