title: Add method to UINavigationBar back button?
body: <p>How can i add method to UINavigationbar back button, so whenever I click that back button I need to check some values and show UIAlertView?  Is there any option for this?</p>
  
  <p>i tried this method but its working for me</p>
  
  <pre><code>  - (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated 
      {
      //show alert 
      }
  </code></pre>
  
  <p>and also this method but both are not woking</p>
  
  <pre><code>-(void) viewWillDisappear:(BOOL)animated {
      if ([self.navigationController.viewControllers indexOfObject:self]==NSNotFound) {
          // back button was pressed.  We know this is true because self is no longer
          // in the navigation stack.
           NSLog(@"hi");
      }
  </code></pre>