Search code examples
iosios5uitabbarcontrolleruitabbar

UITabBar gets rid of UINavigation item on the top of the screen when it is clicked


I am making an app which has a UITabBar and a UINavigationConroller. When I click around the app, the nav item on top of the screen appears and so does the UITabBar on the bottom of the screen.

But when I click on one of the UITabBar items, it does go to the screen it is supposed to go to, but for some reason the UINavigationItem disappears.

Would anyone know why this happens?

Thanks!


Solution

  • IN all of your ViewController use the following Code.

    -(void)viewWillAppear:(BOOL)animated{
        [super viewWillAppear:animated];
     [self.navigationController setNavigationBarHidden:NO];
        }
    
    -(void)viewWillDisappear:(BOOL)animated{
        [super viewWillDisappear:animated];
       [self.navigationController setNavigationBarHidden:YES];
    }
    

    When you want to show Navigationcontroller use Hidden:NO