转自出处:http://stackoverflow.com/questions/6276819/ios-two-uialert-with-two-different-delegate-methods
IOS: two UIAlert with two different delegate methods
Simply set a tag to each Alert view and check which one sent the messeg.
alertView.tag=0;
And then
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
if(alertView.tag==0){
if(buttonIndex == 0)//OK button pressed
{
//do something
}
else if(buttonIndex == 1)//Annul button pressed.
{
//do something
}
}else{
if(buttonIndex == 0)//OK button pressed
{
//do something
}
else if(buttonIndex == 1)//Annul button pressed.
{
//do something
}
}