title: Back navigation from an alert view button
body: <p>I'm having some problems with back navigation to previous view controller (in the stack of my navigation controller) when user taps the custom "back" button that is shown in an alert view.
  I've tried several ways to do it, but I haven't been able to do it. When that button is tapped, the application simply goes back to the controller that popped the alert (as if the user press the "cancelButton").
  Hope you can understand me with this sample code:</p>
  
  <p>In viewDidLoad, I pop up the alert with:</p>
  
  <pre><code>UIAlertView *alert = [[UIAlertView alloc] 
          initWithTitle:@"XXXXXX"
          message:@"" 
          delegate:self  
          cancelButtonTitle:@"OK"
          otherButtonTitles:@"Back", nil];
      [alert show];
      [alert release];
  </code></pre>
  
  <p>Then, inside the code of the view controller I call next action to try to navigate back:</p>
  
  <pre><code>- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{ 
  if (buttonIndex == 1)
  {
      [self.navigationController popViewControllerAnimated:YES];
  }}
  </code></pre>
  
  <p>The whole code is executed and it has no debug errors.
  If I haven't explained my trouble properly, please tell me and I'll try to do it better! (I'm Spanish and my English is not the best).
  Thanks in advance.</p>
  
  <hr>
  
  <p>I'll try to explain it better, in order to show you that my problem could be harder to resolve...</p>
  
  <p>I have a navigation controller, that in a determinate moment, shows a view with a tab bar. You may know that there is not way to implement a tab bar controller inside a navigation controller, so I've used a "custom controller" that inserts that tab bar.</p>
  
  <p>Then, from that view with the tab bar, (inside which I have already added some subviews) I want to navigate back (clicking the alert button) to the view without tab bar, that I supose to be the previous view in the stack of the navigation, as I can see when I push the back button in the navigation bar...</p>
  
  <p>I don't know if now it's clearer or I have confused you more...
  I could try to make you a diagram of controllers, if you want so.
  Thanks for your help!</p>