在iOS 6中隐藏TabBar [英] Hide TabBar in iOS 6

查看:86
本文介绍了在iOS 6中隐藏TabBar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 iOS 6 中隐藏我的TabBar,当我编写下面给出的代码时,它可以在 iOS 7中运行但它在 iOS 6中显示黑线

I want to Hide my TabBar in iOS 6, when i wrote the code which is given below it works in iOS 7 but it shows black line in iOS 6

self.tabBarController.tabBar.hidden = YES;

以下是 iOS 6的快照

推荐答案

尝试使用以下代码可能会帮助您...

Try with below code May be this will help you...

- (void)hideTabBar:(UITabBarController *) tabbarcontroller
{        
    for(UIView *view in tabbarcontroller.view.subviews)
    {
        if([view isKindOfClass:[UITabBar class]])
        {
            if([UIScreen mainScreen].bounds.size.height==568)
            {
                 [view setFrame:CGRectMake(view.frame.origin.x, 568 +20, view.frame.size.width, view.frame.size.height)];
            }
            else
            {
                 [view setFrame:CGRectMake(view.frame.origin.x, 480+20, view.frame.size.width, view.frame.size.height)];
            }

        }
        else
        {
            if([UIScreen mainScreen].bounds.size.height==568)
            {
                [view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, 568)];
            }
            else
            {
                [view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, 480)];
            }
        }
    }
}

- (void)showTabBar:(UITabBarController *) tabbarcontroller
{
    for(UIView *view in tabbarcontroller.view.subviews)
    {
        if([view isKindOfClass:[UITabBar class]])
        {
            if([UIScreen mainScreen].bounds.size.height==568)
            {
                [view setFrame:CGRectMake(view.frame.origin.x, 519, view.frame.size.width, view.frame.size.height)];
            }
            else
            {
                [view setFrame:CGRectMake(view.frame.origin.x, 431, view.frame.size.width, view.frame.size.height)];
            }
        }
        else
        {
            if([UIScreen mainScreen].bounds.size.height==568)
            {
                [view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, 519)];
            }
            else
            {
                [view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, 431)];
            }
        }
    }
}

这篇关于在iOS 6中隐藏TabBar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆