I created a two-button alert view using the following code:
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle: title message: msg delegate:nil cancelButtonTitle:@"Replay" otherButtonTitles:@"Highscore", nil]; [alertView show];
I want to run the code when I click one of the buttons. To do this, I added the following file to the delegate.m file:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { if (buttonIndex==0)
But this method is not called when I press any of the buttons! Can someone tell me why?
Thanks in advance,
Sagiftw
objective-c iphone uialertview
Sagiftw
source share