Skip to content

Instantly share code, notes, and snippets.

@c16a
Last active November 10, 2019 05:52
Show Gist options
  • Save c16a/d50e28d5669952cff2f7a781d7f7f203 to your computer and use it in GitHub Desktop.
Save c16a/d50e28d5669952cff2f7a781d7f7f203 to your computer and use it in GitHub Desktop.
UIAlertController* alert=[UIAlertController alertControllerWithTitle:@"Title" message:@"Message" preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* yesButton = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {
NSLog(@"You pressed Yes, please button");
// call method whatever u need
}];
UIAlertAction* noButton = [UIAlertAction actionWithTitle:@"No"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action)
{
NSLog(@"you pressed No button");
// call method whatever u need
}];
[alert addAction:yesButton];
[alert addAction:noButton];
[self presentViewController:alert animated:YES completion:nil];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment