How to hide UITabBarController programmatically?

前端 未结 5 1690
小蘑菇
小蘑菇 2020-12-05 15:46

Is it possible to hide it with animation ?

5条回答
  •  半阙折子戏
    2020-12-05 16:21

    A UITabBar inherits from UIView, so you can hide it and animate it like you would with a standard UIView.

    - (void) hideTheTabBarWithAnimation:(BOOL) withAnimation {
        if (NO == withAnimation) {
            [theTabBar setHidden:YES];
        } else {
            [UIView beginAnimations:nil context:nil];
            [UIView setAnimationDelegate:nil];
            [UIView setAnimationDuration:0.75];
    
            [theTabBar setAlpha:0.0];       
    
            [UIView commitAnimations];
        }
    }
    

提交回复
热议问题