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?

Louie
  • 5,920
  • 5
  • 31
  • 45

2 Answers2

0

The answer is probably more irritating. If you are talking about a tabbar owned by a tabbarcontroller you can't. With some trick you can move it, but unfortunately the view doesn't resize correctly. The only way is create your own similar tabbarcontroller using tabbar delegate ptotocol. Maybe in ios5 they changed something, but when I tried in ios4 I've found faster creatin my own tab bar controller.

Andrea
  • 26,120
  • 10
  • 85
  • 131
0

Use this code

- (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;
}
Andrea
  • 26,120
  • 10
  • 85
  • 131