GoodsBannerCollectionViewCell.m 955 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. //
  2. // GoodsBannerCollectionViewCell.m
  3. // westkissMob
  4. //
  5. // Created by 王猛 on 2022/9/14.
  6. //
  7. #import "GoodsBannerCollectionViewCell.h"
  8. @implementation GoodsBannerCollectionViewCell
  9. - (instancetype)initWithFrame:(CGRect)frame
  10. {
  11. self = [super initWithFrame:frame];
  12. if (self) {
  13. [self tt_addSubViews];
  14. }
  15. return self;
  16. }
  17. -(void)tt_addSubViews{
  18. [self addSubview:self.imgV];
  19. [self.imgV mas_makeConstraints:^(MASConstraintMaker *make) {
  20. make.left.right.top.bottom.mas_equalTo(0);
  21. }];
  22. }
  23. -(void)setModel:(GoodsBannerModel *)model{
  24. _model = model;
  25. if (model.cellType == CellContentTypeImg) {
  26. self.imgV.hidden = NO;
  27. [self.imgV sd_setImageWithURL:[NSURL URLWithString:model.url] placeholderImage:UIImageDefaultImg_SD];
  28. }
  29. }
  30. -(UIImageView *)imgV{
  31. if (!_imgV) {
  32. _imgV = [[UIImageView alloc]init];
  33. _imgV.userInteractionEnabled = YES;
  34. }
  35. return _imgV;
  36. }
  37. @end