title: Pause code execution until UIAlertView button is pressed?
body: <p>One of my methods sends a message to an object (what do you know about that), and expects a BOOL for an answer. However, BOOL answer it is expecting is based on the answer to a UIAlertView created in the receiving object's method. However, the code doesn't pause while waiting for the user to answer the UIAlertView. My problem is: how do I use -alertView:clickedButtonAtIndex in the method's return value?</p>
  
  <p>Here's the code the message runs (in this construction, I was expecting navigateAwayFromTab to change based on the user input in the UIAlertView, but it never gets a chance):</p>
  
  <pre><code>- (BOOL)readyToNavigateAwayFromTab {
      NSLog( @"message received by Medical View");
      navigateAwayFromTab = NO;
      UIAlertView *alert = [[UIAlertView alloc]
             initWithTitle:@"Navigate Away From Tab?"
                   message:@"Navigating away from this tab will save your work."
                  delegate:self
         cancelButtonTitle:@"Cancel"
         otherButtonTitles:@"OK", nil
      ];
      [alert show];
      [alert release];
      return navigateAwayFromTab;
  }
  #define CANCEL 0
  #define OK 1
  - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
      if( buttonIndex == OK ) navigateAwayFromTab = YES;
  }
  </code></pre>
  
  <p>I've been reading up on the modal UIAlertView debate, and I agree with apple's implementation - at lest as the rule. However, in this case I don't see any way of solving the problem by putting code in -alertView:clickedButtonAtIndex because I don't need to run code based on the UIAlertView, I just need to read the response. Any suggestions on how I can reach my gaol? I've tried a while loop after [alert show] already, but then the alert doesn't even show then, and for a number of reasons I can't use -viewWillDisapear.</p>
  
  <p><strong>Edit</strong></p>
  
  <p>For those viewing this question in the modern ios era, this question pertained to ios 2</p>