
本文共 3401 字,大约阅读时间需要 11 分钟。
UIAlertController������UIAlertView���UIActionSheet������������������������������������������������������������������������������������������������������UIAlertControllerStyleAlert���UIAlertControllerStyleActionSheet���������������������������������������������������������������
1. UIAlertControllerStyleAlert ������
������������������������������������������������������������������������������������������������������������������������������UIAlertControllerStyleAlert������������������
- (void)onAlertTwoAction:(UIButton *)sender { UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"������" message:@"������������������" preferredStyle:UIAlertControllerStyleAlert]; [alert addTextFieldWithConfigurationHandler:^(UITextField *textField) { textField.placeholder = @"���������"; }]; [alert addAction:[UIAlertAction actionWithTitle:@"������" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { NSLog(@"text = %@", alert.textFields.firstObject.text); NSLog(@"������������"); }]]; [alert addAction:[UIAlertAction actionWithTitle:@"������" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) { NSLog(@"������������"); }]; [self presentViewController:alert animated:YES completion:^{ NSLog(@"alert completion"); }];}
2. UIAlertControllerStyleActionSheet ������
������������������������������������������������������������������������������������������UIAlertControllerStyleActionSheet������������������
- (void)onActionSheetAction:(UIButton *)sender { UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"������" message:@"������������������" preferredStyle:UIAlertControllerStyleActionSheet]; [alert addAction:[UIAlertAction actionWithTitle:@"���������" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { NSLog(@"���������"); }]]; [alert addAction:[UIAlertAction actionWithTitle:@"���������" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { NSLog(@"���������"); }]]; [alert addAction:[UIAlertAction actionWithTitle:@"������" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) { NSLog(@"������������"); }]; [self presentViewController:alert animated:YES completion:nil];}
ULAReceiverstyleAlert���UIActionSheet���������������������������������������������������������������������������������������������������������������������������������������������cede tasks���������������������������������������������������������������������������������������������������������������������������������������������������������������
发表评论
最新留言
关于作者
