封装了提示框的方法如下,但是这个block是有返回值的,如果要没有返回值应该怎么改?还有点击确定之后是否只需要confirmAction();就可以了?在线等大神
- (void)showAlert:(id)sendTarget message:(NSString *)messageText comfirm:(void (^)(id object))comfirmAction{
UIAlertController *showAlert = [UIAlertController alertControllerWithTitle:@"" message:messageText preferredStyle:UIAlertControllerStyleAlert];
[showAlert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action){
confirmAction(nil);
}]];
//弹出提示框;
[sendTarget presentViewController:showAlert animated:true completion:nil];
}