title: How to hide/show tab bar of a view with a navigation bar in iOS?
body: <p>I have views with a navigation bar and a tab bar. What I would like to happen is to hide the tab bar on a certain view and show the tab bar again when the user changes views.</p>
  
  <p>I saw a snippet of code for hiding the tab bar:</p>
  
  <pre><code>-(void)makeTabBarHidden:(BOOL)hide
  {
      // Custom code to hide TabBar
      if ( [tabBarController.view.subviews count] &lt; 2 ) {
          return;
      }
  
      UIView *contentView;
  
      if ( [[tabBarController.view.subviews objectAtIndex:0] isKindOfClass:[UITabBar class]] ) {
          contentView = [tabBarController.view.subviews objectAtIndex:1];
      } else {
          contentView = [tabBarController.view.subviews objectAtIndex:0];
      }
  
      if (hide) {
          contentView.frame = tabBarController.view.bounds;       
      }
      else {
          contentView.frame = CGRectMake(tabBarController.view.bounds.origin.x,
               tabBarController.view.bounds.origin.y,
               tabBarController.view.bounds.size.width,
               tabBarController.view.bounds.size.height - tabBarController.tabBar.frame.size.height);
      }
  
      tabBarController.tabBar.hidden = hide;
  }
  </code></pre>
  
  <p>from: <a href="http://nickwaynik.com/iphone/hide-tabbar-in-an-ios-app/" rel="nofollow noreferrer">http://nickwaynik.com/iphone/hide-tabbar-in-an-ios-app/</a></p>
  
  <p>I call this on the view wherein I want the tab bar hidden</p>
  
  <pre><code>[self makeTabBarHidden:YES];
  </code></pre>
  
  <p>it works fine when i show/hide it on that view but when I navigate back to the previous view, the tab bar there is also hidden. I tried calling that function in the view's <code>viewDidUnload</code>, <code>viewWillDisappear</code>, <code>viewDidDisappear</code> functions but nothing happens. The same is true when the function is called in the previous view's <code>viewDidLoad</code>, <code>viewWillAppear</code>, <code>viewDidAppear</code> functions.</p>