Last active
August 29, 2015 14:02
-
-
Save yume190/6f5e3b3c07bececc56d2 to your computer and use it in GitHub Desktop.
UIAertController Usage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
changeAlert = [UIAlertController alertControllerWithTitle:@"title" message:@"message" preferredStyle:UIAlertControllerStyleAlert]; | |
UIAlertController* __weak weakAlert = changeAlert; | |
UIAlertAction *alertActionOk = [UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) { | |
UITextField *t = [[weakAlert textFields] firstObject]; | |
DLog(@"%@",t.text); | |
[weakAlert dismissViewControllerAnimated:YES completion:nil]; | |
}]; | |
UIAlertAction *alertActionCancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) { | |
DLog(@"%@",action); | |
}]; | |
UIAlertAction *alertActionTest = [UIAlertAction actionWithTitle:@"Test" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { | |
UITextField *t = [[weakAlert textFields] firstObject]; | |
DLog(@"%@",t.text); | |
[weakAlert dismissViewControllerAnimated:YES completion:nil]; | |
}]; | |
[weakAlert addAction:alertActionOk]; | |
[weakAlert addAction:alertActionCancel]; | |
[weakAlert addAction:alertActionTest]; | |
[weakAlert addTextFieldWithConfigurationHandler:^(UITextField *textField) { | |
textField.placeholder = @"pls"; | |
}]; | |
[self.viewController presentViewController:weakAlert animated:YES completion:nil] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment