Set the tag
property to different values when you display the alert. It's just an integer and can be queried in the callback/delegate method.
Here's an example (using an ActionSheet rather than an AlertView, but the principle is exactly the same):
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Title"
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:@"Some option", nil];
actionSheet.actionSheetStyle = UIActionSheetStyleDefault;
actionSheet.tag = 10;
[actionSheet showInView:self.view];
[actionSheet release];
Then in your selector:
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
switch (actionSheet.tag) {
case 10:
// do stuff
break;
case 20:
// do other stuff
break;
}
}
Of course, you'd use constants rather than literal values, localised strings, etc, but that's the basic idea.