Stan Roger
Stan Roger

Reputation: 67

Hide UITabBar when pushed while retaining touch

I need to hide UITabBar on one view controller. I tried

vc.hideTabBarwhenpushed = TRUE

when pushed; this worked fine, but when I opened a UITable on this view controller, then at the bottom where UITabBar should be, at that place my UITable is not getting touch. I tried doing

[viewController setWantsFullScreenLayout:YES];

but it did't work.

Upvotes: 1

Views: 432

Answers (2)

hypercrypt
hypercrypt

Reputation: 15376

You need to make sure that you are setting the springs and struts of your table view correctly:

springs and struts

Upvotes: 0

Rajneesh071
Rajneesh071

Reputation: 31073

Use this code to hide and show your tabBar

//To Hide Tab Bar

- (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];
} 

//To Show Tab Bar

- (void) showTabBar:(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, 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]; 
}

Upvotes: 2

Related Questions