I'm trying to hide a UITabBarController and UINavigationController simultaneously when a button is touch. I found a very nice code snippet here How to hide uitabbarcontroller 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 self.tabBarController.tabBar.hidden = YES but that only hides the button items not the black bar at the bottom.
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.
-(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)
         {                                  
         }];
    }
}
The hideTabBar and showTabBar methods are the ones from the other post I linked above.
I also tried some other combinations but I can't make it look good. Any ideas?
Thanks in advance.
 
     
     
    