UIAlertAction 弹出对话框9.0后有些变化

UIAlertAction 弹出对话框9.0后有点变化

ios 9.0后再用以前的UIAlertAction 已经不行了 被弃用了 改用这种方法了

UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"提示"message:@"什么怎么怎么样"preferredStyle:UIAlertControllerStyleAlert];

UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {

NSLog(@"点击取消按钮执行");

}];

UIAlertAction *otherAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {

NSLog(@"点击确定按钮执行");

}];

[alertController addAction:cancelAction];

[alertController addAction:otherAction];

[self presentViewController:alertController animated:YES completion:nil];

对里面的确定 取消按钮 执行方法 简单 直白