ios UIAlertController 的用法

 

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

 

posted on 2015-12-25 15:44  codemaker313  阅读(182)  评论(0编辑  收藏  举报

导航