ios UIAlertController 的用法

 1 UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"您确定要删除该商品吗?" preferredStyle:UIAlertControllerStyleAlert];
 2     UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
 3         NSLog(@"取消");
 4     }];
 5     
 6     UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
 7         NSLog(@"确定");
 8     }];
 9     
10     [alert addAction:cancelAction];
11     [alert addAction:okAction];
12     [self presentViewController:alert animated:YES completion:nil];

 

你可能感兴趣的:(ios UIAlertController 的用法)