i need to show a confirm alert after the user press buttonIndex 1
but... if i use popViewcontroller
in clickedButtonAtIndex
it crash without errors.
The problem is that
[self.navigationController popViewControllerAnimated:YES];
is called before second Alert click...
how to fix?
This is my code:
- (void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
if (buttonIndex == 1) {
UIAlertView *alert =
[[UIAlertView alloc] initWithTitle:@"OK!"
message:@"Completed"
delegate:self
cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[alert show];
[alert release];
[self.navigationController popViewControllerAnimated:YES];
}
}