Iphone 在第一个选项卡上隐藏 uitabbar

标签 iphone uitabbarcontroller uitabbar

我的应用程序中有 5 个选项卡,第一个选项卡是欢迎选项卡,当用户单击第一个选项卡时它会显示欢迎屏幕,但仅在第一个选项卡上我想隐藏选项卡栏 我想隐藏第一个选项卡上的选项卡栏,因为它是一个受欢迎的 View 。我进行了搜索,但无法隐藏它,我在欢迎 Controller View didload 中执行了此操作。

    [self.tabBarController.tabBar setHidden:YES];

它隐藏但留空空间。

使用 xcode 4.3.2、storyboard、ios 5

最佳答案

如果隐藏 tabBar 那么如何导航到第二个和第三个选项卡。 我建议添加welcomeView并在welcomeView之后添加tabBar。

或者您可以使用此代码

[self hideTabBar:self.tabBarController];


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

[self  showTabBar:self.tabBarController];  

- (void) showTabBar:(UITabBarController *) tabbarcontroller {

        [UIView beginAnimations:nil context:NULL];
        [UIView setAnimationDuration:0.5];
        for(UIView *view in tabbarcontroller.view.subviews)
        {
            NSLog(@"%@", view);

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

关于Iphone 在第一个选项卡上隐藏 uitabbar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12423713/

相关文章:

iphone - 防止标签栏更改特定索引处的标签 - IOS

uitabbarcontroller - 使用 Storyboards Get TabBar Reference for UIActionSheet showFromTabBar

ios - 按下按钮时呈现新 ViewController 时如何显示 tabBarController

ios - 当 NavigationController 将 View 弹出回到所述 ViewController 时,UITabBar 消失

ios - 在显示转场时隐藏 UITabbar 并显示工具栏

ios - 带有边界限制和动画的平移手势

iphone - 如何确定我的 iOS 设备是否有手电筒?

iphone - 使用 uiwebview 创建一个富文本 uitableviewcell

iPhone SDK 推送通知

ios - 动画期间标签栏闪烁