// // ASProductListImageCell.m // Asteria // // Created by iOS on 2023/6/14. // #import "ASProductListImageCell.h" @implementation ASProductListImageCell - (void)setImgStr:(NSString *)imgStr { [self.imgV sd_setImageWithURL:[NSURL URLWithString:imgStr] placeholderImage:[UIImage imageNamed:@"product_defualtImg"]]; } - (instancetype)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { [self loadSubVs]; } return self; } - (void)loadSubVs { self.backgroundColor = UIColor.clearColor; self.contentView.backgroundColor = UIColor.clearColor; [self.contentView addSubview:self.imgV]; [self.imgV mas_makeConstraints:^(MASConstraintMaker *make) { make.edges.equalTo(self.contentView); }]; } - (UIImageView *)imgV { if (!_imgV) { UIImageView *v = [UIImageView baseImgV]; v.contentMode = UIViewContentModeScaleAspectFill; v.clipsToBounds = true; v.layer.cornerRadius = 8; v.layer.masksToBounds = true; _imgV = v; } return _imgV; } @end