Reputation: 2284
Im working on tab bar application.
in all the view tabbar carried. ok.
but in a particular one view i didn't want to display my tabbar.
when i pushed my view to the next view, tab bar carried to that view also.
when i tried to hide this it shows white space for that view.
what to do.. thnaks in advance
Upvotes: 4
Views: 1639
Reputation: 8106
try....
MyViewController *myController = [[MyViewController alloc] init];
//hide tabbar
myController.hidesBottomBarWhenPushed = YES;
//add it to stack.
[[self navigationController] pushViewController:myController animated:YES];
Upvotes: 12
Reputation: 8138
UITabBar is a top level view which means that almost all over views are underneath it. Even UINavigationController seats bellow tabBar.
You could hide tabBar like this:
- (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 show it back on 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 is of height 50 px by default. So you just need to set new height to the frame and animate it.
Upvotes: 2
Reputation: 20410
You can add your view to the main window, and it will be over the tab bar:
[[myApp appDelegate].window addSubview:myView];
Upvotes: 1