Gui*_*ume 23

UITabBar继承自UIView,因此您可以像使用标准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];
    }
}
Run Code Online (Sandbox Code Playgroud)

  • 虽然我自己没有测试过,但我相信这只会隐藏视图但仍保留其框架(因此这个隐藏框架会阻碍新视图).更好的方法是在将要推送的*vc*上使用hidesBottomBarWhenPushed属性 (2认同)

Pra*_*tel 23

您应该使用此代码:

self.tabBarController.tabBar.hidden=YES;
Run Code Online (Sandbox Code Playgroud)

  • 它为我在选项卡栏上留了一个空白...不是一个好的解决方案 (2认同)

han*_*Dev 6

您还可以使用属性检查器隐藏它:

在此输入图像描述

但没有动画.