1、在cell中给按钮添加方法时,使用方法
.h文件中
typedef void(^ButtonClick)(UIButton * sender);
@property (nonatomic,copy) ButtonClick changeMsgClick;
.m文件中
if (self.changeMsgClick) {
self.changeMsgClick(sender);
}
cell中调用
cell.phoneAction = ^(UIButton * _Nonnull sender) {
[MBProgressHUD showWarningWithText:@"打电话"];
};
2、black传递数据
typedef void(^RequestData) (NSArray* dataArray,NSString* msgStr);
+(void)getIntegralLisrWithParams:(NSDictionary *)par ret:(RequestData)ret{
NSArray * result =@[@"2020-01-05 16:58:46",@"D54496966545",@"甘肃省武威市"];
NSString * integral = @"成功";
ret(result, integral);
return task; }
网友评论