// // LDClassifyRightCollectionViewCell.m // YouHuiProject // // Created by 小花 on 2018/4/28. // Copyright © 2018年 kuxuan. All rights reserved. // #import "LDClassifyRightCollectionViewCell.h" @implementation LDClassifyRightCollectionViewCell { UILabel *_titleLabel; UIImageView *_imgView; } - (instancetype)initWithFrame:(CGRect)frame{ if (self = [super initWithFrame:frame]) { [self setupUI]; } return self; } - (void)setupUI{ _titleLabel = [[UILabel alloc]init]; _titleLabel.textAlignment = NSTextAlignmentCenter; _titleLabel.textColor = [UIColor YHColorWithHex:0x666666]; _titleLabel.font = [UIFont systemFontOfSize:12]; [self.contentView addSubview:_titleLabel]; _imgView = [[UIImageView alloc] init]; _imgView.contentMode = UIViewContentModeScaleAspectFill; [self.contentView addSubview:_imgView]; [_imgView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(FITSIZE(22)); make.centerX.mas_equalTo(self.mas_centerX); make.width.height.mas_equalTo(FITSIZE(50)); }]; [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(_imgView.mas_bottom).mas_offset(FITSIZE(5)); make.left.right.mas_equalTo(0); make.height.mas_equalTo(FITSIZE(20)); }]; } - (void)setModel:(LDSecondCategoryModel *)model { _titleLabel.text = model.name; [_imgView yy_setImageWithURL:[NSURL URLWithString:model.img] options:YYWebImageOptionProgressiveBlur | YYWebImageOptionSetImageWithFadeAnimation]; } @end