title: Hide both Navigation Controller and Tab Bar Controller with animation
body: <p>I'm trying to hide a UITabBarController and UINavigationController simultaneously when a button is touch. I found a very nice code snippet here <a href="https://stackoverflow.com/questions/5272290/how-to-hide-uitabbarcontroller/5272497#comment17733937_5272497">How to hide uitabbarcontroller</a> but I have problem when trying to hide and animate both UINavigationController and the tabbarcontroller. I also found a lot of examples on the internet when they hide the tabbar using <code>self.tabBarController.tabBar.hidden = YES</code> but that only hides the button items not the black bar at the bottom.</p>
  
  <p>After playing a lot around I can get to make both animate correctly because I think that it's related to the hiding of the Navigation Controller which makes the size of the whole window to change on the fly.</p>
  
  <pre><code>-(IBAction)touchImage:(id)sender {
  
      if (isImageFullScreen) {
  
          isImageFullScreen = NO;
  
          [self.navigationController setNavigationBarHidden:NO animated:YES];
          [UIView transitionWithView:self.view
                            duration:0.5
                             options:UIViewAnimationOptionCurveLinear
                          animations:^
           {
               hotelImageButton.frame = CGRectMake(0,20,320,92);
               [self showTabBar:self.tabBarController];
           }
                          completion:^(BOOL finished)
           {
           }];
  
      } else {
  
          isImageFullScreen = YES;
  
          [self.navigationController setNavigationBarHidden:YES animated:YES];
          [UIView transitionWithView:self.view
                            duration:0.5
                             options:UIViewAnimationOptionCurveLinear
                          animations:^
           {
               hotelImageButton.frame = CGRectMake(0,0,320,480);
               [self hideTabBar:self.tabBarController];
           }
                          completion:^(BOOL finished)
           {                                  
           }];
      }
  </code></pre>
  
  <p>}</p>
  
  <p>The hideTabBar and showTabBar methods are the ones from the other post I linked above.</p>
  
  <p>I also tried some other combinations but I can't make it look good. Any ideas?</p>
  
  <p>Thanks in advance.</p>