title: ios - I have a 2-button UIAlertView, how do I know which button is pressed?
body: <p>I have this 2-button alert view:</p>
  
  <pre><code>UIAlertView* message = [[UIAlertView alloc]
                             initWithTitle: @"Delete?" message: @"This business will be deleted permenently." delegate: nil
                             cancelButtonTitle: @"Cancel" otherButtonTitles: @"Delete", nil];
  
  [message show];
  </code></pre>
  
  <p>I also have this method:</p>
  
  <pre><code>- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
  {
      NSString *title = [alertView buttonTitleAtIndex:buttonIndex];
      if([title isEqualToString:@"Delete"])
      {
          NSLog(@"Button DELETE was selected.");
      }
      else if([title isEqualToString:@"Cancel"])
      {
          NSLog(@"Button CANCEL was selected.");
      }
  }
  </code></pre>
  
  <p>and I added this to the .h file:</p>
  
  <pre><code>&lt;UIAlertViewDelegate&gt;
  </code></pre>
  
  <p>Right now when either button is pressed, it just closes the dialog. That is ok for cancel, but how do I know when the delete button is pressed?</p>
  
  <p>Thanks!</p>