3

My iOS 7 app uses UINavigationController with a hidden navigation bar. The top of my main screen includes a custom tab bar. I want to rely exclusively on the swipe to go back gesture, or the navigation buttons in the tab bar, without displaying the navigation bar and its back button.

What I'm observing is that setting self.navigationController.navigationBarHidden = YES hides the navigation bar and disables the gesture recognizer. Swiping left to right from the screen edge does nothing when I've descended a level in the navigation controller.

With this code:

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    self.navigationController.navigationBarHidden = YES;
}

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    NSLog(@"%@", self.navigationController.interactivePopGestureRecognizer);
    NSLog(@"%@", self.navigationController.interactivePopGestureRecognizer.delegate);
}

I get:

2013-12-09 22:18:32.082 Redacted[496:60b] ; target= <(action=handleNavigationTransition:, target=<_UINavigationInteractiveTransition 0x146612f0>)>>

2013-12-09 22:18:36.795 Redacted[496:60b] <_UINavigationInteractiveTransition: 0x146612f0>

...which is the same regardless if I'm setting navigationBarHidden to YES or NO. So, the gesture recognizer, and its delegate, are both valid.

So why is this gesture recognizer not working when the navigation bar is hidden, and how do I fix that?

This is an iOS 7 app for iPhone/iPod touch screens.

bneely
  • 9,083
  • 4
  • 38
  • 46
  • 1
    Please try this, http://stackoverflow.com/questions/19054625/changing-back-button-in-ios-7-disables-swipe-to-navigate-back – iEngineer Dec 10 '13 at 06:47
  • Yes, that worked. This can be marked as a duplicate. – bneely Dec 10 '13 at 08:06
  • I have the same problem. May I know which answer on that solution worked? I tried the accepted answer and it did not work. That question seems to be about a back button image, while my problem is with the hidden navbar. – sosale151 Jun 04 '15 at 09:41
  • Looking at this again, I believe I implemented the accepted answer on that other question. However, I later changed the user interface and no longer depend on this. – bneely Jun 09 '15 at 02:11

0 Answers0