4

i am making an application in iphone in which i have 4 tabbars & in one of its tab i have 4 views in 2nd view it needs to hide the tab bar. I am able to hide the tab bar using the setHidesBottomBarWhenPushed:YES in in the initWithNib method of the Viewcontroller being pushed. But when navigating to the screen 3 , calling the same method with "NO" does not make the tab bar appear. any ideas?

4 Answers4

8

John Smith is correct. The URL for that sample is: http://developer.apple.com/iphone/library/samplecode/TheElements/index.html

The code that does this is in AtomicElementViewController.m, and the line that achieves this effect is in the init method:

    self.hidesBottomBarWhenPushed = YES;
esilver
  • 27,713
  • 23
  • 122
  • 168
7

I had the same issue to show or hide tab bar controller with UITableViewController customized class. Somehow, by using the following codes, does not work to hide tab bar controller:

- (void) viewDidLoad {
     self.hidesBottomBarWhenPushed = YES;

}

In the case of storyboard with segue, initWithStyle: method does not get called.

Instead, I have to overwrite the property to make it work:

- (BOOL) hidesBottomBarWhenPushed {
  return YES;
}

My case is for iOS 5.1 with storyboard and segue to push to the next view (where I want to hide tab bar controller).

IronManGill
  • 7,222
  • 2
  • 31
  • 52
David.Chu.ca
  • 37,408
  • 63
  • 148
  • 190
1

Take a look at Apple's Elements projects. They hide and unhide the tab-bar when you view and individual element.

John Smith
  • 12,491
  • 18
  • 65
  • 111
1

Before you push your 3rd view onto the stack, set the 2nd view's hidesBottomBarWhenPushed to NO.

Jay
  • 171
  • 2
  • 5