Paste the following code to implement the event handler within the @implementation section:
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
{
if ([alertView tag] == 12)
{
if (buttonIndex == 0)
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Response" message:@"You chose the default button (which is Cancel in this case)" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
}
else if (buttonIndex == 1)
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Response" message:@"You selected Option 1" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
}
else if (buttonIndex == 2)
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Response" message:@"You selected Option 2" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
}
}
}
No comments:
Post a Comment