UITabBar is not hiding

I have a UINavigationController in a UITabBarController and I do not see to hide the hidden viewController tabBar element.

I use the following code to hide it:

Before it is pressed:

tpsv.hidesBottomBarWhenPushed = YES; tpsv.tabBarController.hidesBottomBarWhenPushed = YES;

viewWillAppear:

self.tabBarController.tabBar.hidden = YES;

AppDelegate *del = (AppDelegate *)[[UIApplication sharedApplication] delegate];

[[[del tabController] tabBar]setHidden:YES];

But none of this works.

If you could tell me how to fix this, that would be great.

0
source share
3 answers
 - (void) hideTabBar:(UITabBarController *) tabbarcontroller { [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:0.5]; 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.5]; for(UIView *view in tabbarcontroller.view.subviews) { NSLog(@"%@", view); 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]; } 
+2
source

You install this before pushing a new view controller:

 MyViewController *myVC = [[[MyViewController alloc] init] autorelease]; myVC.hidesBottomBarWhenPushed = YES; [self.navigationController pushViewController:myVC animated:YES]; 

[EDIT: using comments]

Just noticed that you say you tried it. Not sure what else you are doing in the context of pressing VC or setting it up, but this works fine. This is how I do it in my applications.

+4
source

I had the same problem with

 myVC.hidesBottomBarWhenPushed = YES; 

It does not remove the tab bar in subsequent views. Maybe it's out of date. You should not encounter this problem with the setHidesBottomBarWhenPushed: command. Try using the following types:

 MyViewController *myVC = [[[MyViewController alloc] init] autorelease]; [myVC setHidesBottomBarWhenPushed:YES]; [self.navigationController pushViewController:myVC animated:YES]; 
0
source

All Articles