Skip to content

Instantly share code, notes, and snippets.

@hanksudo
Created February 9, 2011 08:59
Show Gist options
  • Save hanksudo/818173 to your computer and use it in GitHub Desktop.
Save hanksudo/818173 to your computer and use it in GitHub Desktop.
Retry Alert form, need to set UIAlertViewDelegate protocols
- (void)handleError:(NSError *)error {
NSString *errorMessage = [error localizedDescription];
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error Message"
message:errorMessage
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"Retry", nil];
[alertView show];
[alertView release];
}
// Handle alert form click event
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
switch (buttonIndex) {
case 0:
NSLog(@"%@", @"Button Cancel Pressed");
break;
case 1:
NSLog(@"%@", @"Button Retry Pressed");
break;
default:
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment