title: Trying to handle "back" navigation button action in iOS
body: <p>I need to detect when the user taps the "back" button on the navigation bar, in order to perform some operations when that occurs. I'm trying to set manually an action to such button, this way:</p>
  
  <pre><code>[self.navigationItem.backBarButtonItem setAction:@selector(performBackNavigation:)];
  
  - (void)performBackNavigation:(id)sender
  {
     // Do operations
  
     [self.navigationController popViewControllerAnimated:NO];
  }
  </code></pre>
  
  <p>I firstly placed that code in the view controller itself, but I found that <code>self.navigationItem.backBarButtonItem</code> seemed to be <code>nil</code>, so I moved that same code to the parent view controller, which pushes the former to the navigation stack. But I'm neither able to make it work. I've read some posts regarding this issue, and some of them said that the selector needs to be set at the parent view controller, but for me it doesn't work anyway... What could I'm doing wrong?</p>
  
  <p>Thanks</p>