title: UINavigationBar: intercept back button and back swipe gesture
body: <p>I have a UINavigationBar that intercepts the back button tap that alerts the user if there are unsave changes. This is based on the solution presented in <a href="https://stackoverflow.com/questions/6413595/uinavigationcontroller-and-uinavigationbardelegate-shouldpopitem-with-monotouc">UINavigationController and UINavigationBarDelegate.ShouldPopItem() with MonoTouch</a> using the UINavigationBarDelegate protocol and implementing <code>- (BOOL)navigationBar:(UINavigationBar *)navigationBar shouldPopItem:(UINavigationItem *)item;</code></p>
  
  <p>Now, iOS7 has introduced the swipe-to-go-back gesture, and I'd like to intercept that as well, but can't get it to work with the solutions I've found so far, namely using <code>[self.interactivePopGestureRecognizer addTarget:self action:@selector(handlePopGesture:)];</code> and </p>
  
  <pre><code>- (void)handlePopGesture:(UIGestureRecognizer *)gesture {
      if (gesture.state == UIGestureRecognizerStateEnded) {
          [self popViewControllerAnimated:NO];
      }
  }
  </code></pre>
  
  <p>While this does pop the views, it leaves the navigation bar buttons in place, so I'm ending up with a back button that leads nowhere, as well as all other navigation button I've added to the nav bar. Any tips?</p>