Swift 高级进阶iOS 开发进阶

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);
    }
}
上一篇下一篇

猜你喜欢

热点阅读