Yes, you can use multiple buttons in the UIAlertView, and delegate methods are called for each click. However, this should not freeze your application. Go through your code to find the problem.
To prevent multiple events from being processed, set the UIAlertView delegation property to nil after processing the first:
- (void)showAlert { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Title" message:@"Message" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil]; [alert show]; } - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { // Avoid further delegate calls alertView.delegate = nil; // Do something if (buttonIndex == alertView.cancelButtonIndex) { // User cancelled, do something } else { // User tapped OK, do something } }
source share