Search code examples
objective-ciosxcodempmovieplayercontroller

Hide navigationBar, Show navigationBar


I met with a problem. At first some code from AppDelegate.

 - (void)HideMainNavigationBar{
navigCtrl.navigationBarHidden = YES;
}

- (void)ShowMainNavigationBar{
navigCtrl.navigationBarHidden = NO;
}

navigCtrl is my navigation controller. In my other View Controller I need hide my navigationBar and then show it, to display it correctly.

- (void) moviePlayerWillExitFullScreen:(id)sender {
   NSLog(@"exitfullscreen");
   AppDelegate *ptr = [AppDelegate SharedAppDelegate];
   [ptr HideMainNavigationBar];
   [ptr ShowMainNavigationBar];
}

After that, instead of my custom tabBarButton I saw Back button:

enter image description here

After tap ob Back button, it disappears, and I see my navigationBar again with my custom button. This 'bug' was detected in iOS 5.1, on iOS 4.3.2 everithing is ok.

This makes me crazy, help please.

P.S. I know, that I can use:

self.navigationController.navigationBar.frame = CGRectMake(0, 20, self.navigationController.navigationBar.frame.size.width, self.navigationController.navigationBar.frame.size.height);

to display navigationBar correctly, but i need to show/hide navigationBar to hide it, while rotating VideoPlayer.

Any ideas? Wait your answers, thanks.


Solution

  • So, after some manipulations I decided simply to set alpha to my navigationBar.

    if (SYSTEM_VERSION_LESS_THAN(@"5"))  
                [ptr HideMainNavigationBar];
    else self.navigationController.navigationBar.alpha = 0;
    

    I hope it would be useful for someone. See ya.