0

Ive spent 3 hours on this now, its really irritating me. I need to hide the tabbar for certain views and bring it back for others. I have been trying

self.hidesBottomBarWhenPushed = TRUE;

with no success. (because some views I have to POP off the screen and that only works with PUSH and its even at that it doesnt seem to work right)

So I was wondering if I could move the "frame" of a tabbar somehow to just below the screen view and then bring it back up when I need it, even with an animation would be nice?

4

2 回答 2

0

答案可能更令人恼火。如果您谈论的是 tabbarcontroller 拥有的 tabbar,则不能。通过一些技巧,您可以移动它,但不幸的是视图没有正确调整大小。唯一的方法是使用 tabbar delegate ptotocol 创建自己的类似 tabbarcontroller。也许在 ios5 中他们改变了一些东西,但是当我在 ios4 中尝试时,我发现创建自己的标签栏控制器的速度更快。

于 2012-05-25T04:16:55.540 回答
0

使用此代码

- (void) hidetabbar {

    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.5];

    for(UIView *view in appDelegate.objtabbar.view.subviews)
    {
        NSLog(@"%@", view);

        if([view isKindOfClass:[UITabBar class]]||[view isKindOfClass:[UIButton class]]||[view isKindOfClass:[UIImageView class]])
        {
            if (hiddenTabBar) {
                [view setFrame:CGRectMake(view.frame.origin.x, 431, view.frame.size.width, view.frame.size.height)];
            } else {
                [view setFrame:CGRectMake(view.frame.origin.x, 480, view.frame.size.width, view.frame.size.height)];
            }
        } else {
            if (hiddenTabBar) {
                [view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, 431)];
            } else {
                [view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, 480)];
            }
        }
    }
    [UIView commitAnimations];

    hiddenTabBar = !hiddenTabBar;
}
于 2012-05-25T04:23:45.960 回答