iOS 方法中block响应点击事件
2018-10-23 本文已影响6人
屈涯
+(YHAdsShareGetMoneyView *)createShareGetMoney:(CGFloat)money shareType:(YHShareAdsType)shareType superView:(UIView *)showView buttonAction:(void (^)(UIButton *sender))buttonClickBlock
{
YHAdsShareGetMoneyView *adsMoney = [[YHAdsShareGetMoneyView alloc] initWithFrame:CGRectZero shareGetMoney:money shareType:shareType];
adsMoney.buttonClickBlock = buttonClickBlock;
[showView addSubview:adsMoney];
return adsMoney;
}
@property (nonatomic, copy) void (^buttonClickBlock)(UIButton *sender);
-(void)addShareButtonEventAction:(UIButton *)sender
{
if (self.buttonClickBlock) {
self.buttonClickBlock(sender);
}
}