This repository was archived by the owner on Nov 29, 2022. It is now read-only.

Description
In my project,i need a custom view for the customViewForEmptyDataSet. I put a button on my custom view but it can not respond a click event.My code is here:
-(UIView *)customViewForEmptyDataSet:(UIScrollView *)scrollView
{
UIView *holderView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kFrameWidth, kFrameHeight)];
UIImageView *noDataHolder = [[UIImageView alloc]init];
noDataHolder.userInteractionEnabled = YES;
noDataHolder.image = [UIImage imageNamed:@"nodataholder"];
[holderView addSubview:noDataHolder];
[noDataHolder mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.equalTo(@250).priorityHigh();
make.height.equalTo(@320).priorityHigh();
make.center.equalTo(holderView);
}];
UIButton *reloadBtn = [UIButton buttonWithType:UIButtonTypeCustom];
reloadBtn.backgroundColor = kThemeColor;
reloadBtn.layer.cornerRadius = 5;
reloadBtn.titleLabel.font = [UIFont systemFontOfSize:16];
[reloadBtn setTitle:@"重试" forState:UIControlStateNormal];
[reloadBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[reloadBtn setTitleColor:[UIColor lightGrayColor] forState:UIControlStateHighlighted];
[reloadBtn addTarget:self action:@selector(yl_reloadDataAction) forControlEvents:UIControlEventTouchUpInside];
[holderView addSubview:reloadBtn];
[reloadBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.equalTo(@80).priorityHigh();
make.height.equalTo(@35).priorityHigh();
make.bottom.equalTo(noDataHolder).offset(-55);
make.centerX.equalTo(noDataHolder);
}];
return holderView;
}
How can i let the reloadBtn respond a UIControlEventTouchUpInside event?