// // ASHomeLookingCollCell.m // Asteria // // Created by iOS on 2023/6/10. // #import "ASHomeLookingCollCell.h" @interface ASHomeLookingCollCell () @property (nonatomic, strong) UIImageView *imgV; @property (nonatomic, strong) UILabel *titleLb; @property (nonatomic, strong) ASHomeCategoryModel *model; @end @implementation ASHomeLookingCollCell - (void)setData:(ASHomeCategoryModel *)m { self.model = m; [self.imgV sd_setImageWithURL:[NSURL URLWithString:m.imgUrl] placeholderImage:[UIImage imageNamed:@"product_defualtImg"]]; self.titleLb.text = m.title; } - (instancetype)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { [self loadVs]; } return self; } - (void)loadVs { [self.contentView addSubview:self.imgV]; [self.contentView addSubview:self.titleLb]; [self.imgV mas_makeConstraints:^(MASConstraintMaker *make) { make.top.leading.trailing.equalTo(self.contentView); make.width.equalTo(self.imgV.mas_height); }]; [self.titleLb mas_makeConstraints:^(MASConstraintMaker *make) { make.height.equalTo(@18); make.bottom.leading.trailing.equalTo(self.contentView); }]; } - (UIImageView *)imgV { if (!_imgV) { UIImageView *v = [UIImageView baseImgV]; v.contentMode = UIViewContentModeScaleAspectFill; v.layer.cornerRadius = 8; v.layer.masksToBounds = true; v.clipsToBounds = true; _imgV = v; } return _imgV; } - (UILabel *)titleLb { if (!_titleLb) { UILabel *lb = [UILabel baseLb]; lb.font = [UIFont fontWithName:Rob_Regular size:12]; lb.textAlignment = NSTextAlignmentCenter; lb.textColor = Col_000; _titleLb = lb; } return _titleLb; } @end