1.定义block的两种方式:
-直接定义:
//@property (nonatomic,copy) void (^callBack)(NSInteger index,id info);
-type定义,重用
typedef void (^callBack)(NSInteger index,id info);
@property (nonatomic,strong) callBack callBack;
2.代码中使用:
if (_callBack) {
_callBack(centerImageIndex,_imageModels[centerImageIndex]);
}
时间: 2024-10-03 20:22:43