How to hide a tab in a certain form?

Im working on a tab bar app.

in all displayed tabs. OK.

but in a specific view, I did not want to display my tab.

when I moved my view to the next view, the tab bar moved to that view.

when I tried to hide it, it displays a space for this view.

what to do .. thnaks in advance

+4
source share
3 answers

to try ....

MyViewController *myController = [[MyViewController alloc] init]; //hide tabbar myController.hidesBottomBarWhenPushed = YES; //add it to stack. [[self navigationController] pushViewController:myController animated:YES]; 
+11
source

UITabBar is a top-level view, which means that almost all views are under it. Even the UINavigationController sits below the tabBar.

You can hide the tabBar as follows:

 - (void)hideTabBar:(UITabBarController *)tabbarcontroller withInterval:(NSTimeInterval)delay { [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:delay]; for(UIView *view in tabbarcontroller.view.subviews) { if([view isKindOfClass:[UITabBar class]]) { [view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y+50, view.frame.size.width, view.frame.size.height)]; } else { [view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, view.frame.size.height+50)]; } } [UIView commitAnimations]; } 

And then return it like this:

 - (void)showTabBar:(UITabBarController *)tabbarcontroller withInterval:(NSTimeInterval)delay { [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:delay]; for(UIView *view in tabbarcontroller.view.subviews) { if([view isKindOfClass:[UITabBar class]]) { [view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y-50, view.frame.size.width, view.frame.size.height)]; } else { [view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, view.frame.size.height-50)]; } } [UIView commitAnimations]; } 

UITabBar has a height of 50 pixels by default. Therefore, you just need to set a new frame height and animate it.

+2
source

You can add your view to the main window, and it will be above the tab bar:

 [[myApp appDelegate].window addSubview:myView]; 
+1
source

Source: https://habr.com/ru/post/1400352/


All Articles