ASProductListImageCell.m 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. //
  2. // ASProductListImageCell.m
  3. // Asteria
  4. //
  5. // Created by iOS on 2023/6/14.
  6. //
  7. #import "ASProductListImageCell.h"
  8. @implementation ASProductListImageCell
  9. - (void)setImgStr:(NSString *)imgStr {
  10. [self.imgV sd_setImageWithURL:[NSURL URLWithString:imgStr] placeholderImage:[UIImage imageNamed:@"product_defualtImg"]];
  11. }
  12. - (instancetype)initWithFrame:(CGRect)frame {
  13. self = [super initWithFrame:frame];
  14. if (self) {
  15. [self loadSubVs];
  16. }
  17. return self;
  18. }
  19. - (void)loadSubVs {
  20. self.backgroundColor = UIColor.clearColor;
  21. self.contentView.backgroundColor = UIColor.clearColor;
  22. [self.contentView addSubview:self.imgV];
  23. [self.imgV mas_makeConstraints:^(MASConstraintMaker *make) {
  24. make.edges.equalTo(self.contentView);
  25. }];
  26. }
  27. - (UIImageView *)imgV {
  28. if (!_imgV) {
  29. UIImageView *v = [UIImageView baseImgV];
  30. v.contentMode = UIViewContentModeScaleAspectFill;
  31. v.clipsToBounds = true;
  32. v.layer.cornerRadius = 8;
  33. v.layer.masksToBounds = true;
  34. _imgV = v;
  35. }
  36. return _imgV;
  37. }
  38. @end