title: Deleting a row in a UITableViewController with an alert confirmation
body: <p>I have an <code>UITableViewController</code>, set up so that users can delete rows. This is my code for the handler of the delete action, and the delegate method for the <code>UIAlertView</code>:</p>
  
  <pre><code>- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
  {
      if (editingStyle == UITableViewCellEditingStyleDelete) {
          UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"t" message:@"del?" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Delete", nil];
          [alert show];
      }
  }
  
  - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
  {
      NSIndexPath *path = [self.tableView indexPathForSelectedRow];
      if (buttonIndex != [alertView cancelButtonIndex]) {
          //my code to delete from the data source is here. it works fine.
          [self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:path] withRowAnimation:UITableViewRowAnimationFade];
      }
  }
  </code></pre>
  
  <p>The problem is in that last line where it's supposed to actually delete the rows from the <code>tableView</code>. If I put that (and the code that deletes from the data source) in the first method instead of the <code>UIAlertView</code> stuff, it works fine.</p>
  
  <p>What is the proper way of doing this?</p>