0

I have changed the frame of the tabBar in the viewController:

self.tabBar.frame.origin.y = CGRectGetHeight(self.view.frame).

But tabBars reset to their Original frame when a new ViewController is pushed. How can I hide the tabBar when I push a new ViewController?

mginn
  • 16,036
  • 4
  • 26
  • 54
Mr.Wang
  • 25
  • 4
  • I guess you're using Auto Layout, right? You should set the constraints instead. – Raptor Jun 01 '15 at 02:18
  • possible duplicate of [Hiding UITabBar when pushing a UIView](http://stackoverflow.com/questions/675887/hiding-uitabbar-when-pushing-a-uiview) – mginn Jun 01 '15 at 02:47

1 Answers1

3

Set hidesBottomBarWhenPushed to YES on your UIViewController.

Dash
  • 17,188
  • 6
  • 48
  • 49
  • Right, this can be achieved. But when I return, I need to show tabbar。 -(void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; self.hidesBottomBarWhenPushed = NO; } It's not working. – Mr.Wang Jun 01 '15 at 03:13