【问题标题】:Hide UITabBar when pushed while retaining touch在保持触摸的同时按下时隐藏 UITabBar
【发布时间】:2012-07-01 16:19:39
【问题描述】:

我需要在一个视图控制器上隐藏UITabBar。我试过了

vc.hideTabBarwhenpushed = TRUE

当被推时;这工作得很好,但是当我在这个视图控制器上打开一个UITable 时,然后在UITabBar 应该在的底部,在那个地方我的UITable 没有接触到。 我试过做

[viewController setWantsFullScreenLayout:YES];

但它没有工作。

【问题讨论】:

  • 您使用的是UITableViewController吗?
  • 我需要检查谁的用户交互,iApple

标签: iphone objective-c ios uitabbarcontroller


【解决方案1】:

您需要确保正确设置表格视图的弹簧和支柱:

【讨论】:

    【解决方案2】:

    使用此代码隐藏和显示您的 tabBar

    //隐藏标签栏

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

    //显示标签栏

    - (void) showTabBar:(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, 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]; 
    }
    

    【讨论】:

    • 它隐藏了标签栏,但我仍然无法接触到 UItabbar 的 UITableView 位置..
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-06-06
    • 1970-01-01
    • 1970-01-01
    • 2018-11-29
    • 1970-01-01
    • 1970-01-01
    • 2010-10-15
    相关资源
    最近更新 更多