Skip to content

Instantly share code, notes, and snippets.

@RameshAran
Created September 17, 2016 05:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RameshAran/327fc595a127ae2786af4c8760150619 to your computer and use it in GitHub Desktop.
Save RameshAran/327fc595a127ae2786af4c8760150619 to your computer and use it in GitHub Desktop.
- (void)showAlertWithTwoButtons {
UIAlertController *alertView = [UIAlertController alertControllerWithTitle:@"Alert!"
message:@"This is an Alert."
preferredStyle:UIAlertControllerStyleAlert];
[alertView addAction:[UIAlertAction actionWithTitle:@"ok"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) {
NSLog(@"action - %@", action.title);
}]];
[alertView addAction:[UIAlertAction actionWithTitle:@"Cancel"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) {
NSLog(@"action - %@", action.title);
}]];
[self presentViewController:alertView animated:YES completion:^{
NSLog(@"alertView shown!");
}];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment