0
点赞
收藏
分享

微信扫一扫

block使用时不判空,当使用的block没有实现,会crash

晒大太阳了 2022-08-18 阅读 55


block使用时不判空,当使用的block没有实现,会crash。

- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
self.backgroundColor = [UIColor whiteColor];
if (self) {
for (int i = 0; i<3; i++) {

ImageTitleButton *btn = [[ImageTitleButton alloc]initWithType:ImageTopTitleBottom andTitleFont:NFont(13) andTitle:@[@"好友",@"关注",@"粉丝"][i] andImage:[UIImage imageNamed:@[@"friends",@"follow",@"fans"][i]] andFrame:CGRectMake(0, 0, PPImageTitleBtnW, PPImageTitleBtnH)];

// if(self.clickAction)
{
self.clickAction(button.titleButton.titleLabel.text,button);
}
}];
if (i == 0) {
}
}
[self upFrame];
}
return self;
}


举报

相关推荐

0 条评论