How to hide tab bar programmatically and then expand view to fit

前端 未结 5 709
余生分开走
余生分开走 2021-01-15 11:39

I got the code from this question: How to hide UITabBarController programmatically? which is brilliant, however the view doesn\'t expand to fit the space left by the tab bar

5条回答
  •  感动是毒
    2021-01-15 11:55

    The easiest way is probably to set a new frame for the view:

    CGRect viewFrame = view.frame;
    viewFrame.size.height += 40; // Change this to the height of the tab bar
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:0.75];
    
    view.frame = viewFrame;
    
    [UIView commitAnimations];
    

提交回复
热议问题