Hide UITabBar when pushed while retaining touch

后端 未结 2 784
滥情空心
滥情空心 2020-12-07 05:10

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

vc.hideTabBarwhenpushed = TRUE

when pushed; this worked fine, but when

相关标签:
2条回答
  • 2020-12-07 06:06

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

    springs and struts

    0 讨论(0)
  • 2020-12-07 06:07

    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]; 
    }
    
    0 讨论(0)
提交回复
热议问题