Try the following:
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Welcome" message:@"Message." delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:@"Button 2", @"Button 3", nil];
alert.tag = 1;
[alert show];
then do the same for the next alertView, just change the tag to 2
Then just run this method
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if(alert.tag == 1) {
}
}
Also, make sure you turn on UIAlertViewDelegate
source
share