1

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

vc.hideTabBarwhenpushed = TRUE

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

[viewController setWantsFullScreenLayout:YES];

但它没有用。

4

2 回答 2

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]; 
}
于 2012-06-30T12:09:10.883 回答
0

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

弹簧和支柱

于 2012-06-30T18:43:06.120 回答