ASCategaryCollectCell.m 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. //
  2. // ASCategaryCollectCell.m
  3. // Asteria
  4. //
  5. // Created by iOS on 2023/6/6.
  6. //
  7. #import "ASCategaryCollectCell.h"
  8. @implementation ASCategaryCollectCell
  9. - (instancetype)initWithFrame:(CGRect)frame {
  10. self = [super initWithFrame:frame];
  11. if (self) {
  12. [self loadSubV];
  13. }
  14. return self;
  15. }
  16. - (void)loadSubV {
  17. self.contentView.backgroundColor = UIColor.whiteColor;
  18. [self.contentView addSubview:self.imgV];
  19. [self.imgV mas_makeConstraints:^(MASConstraintMaker *make) {
  20. make.edges.equalTo(self.contentView);
  21. make.width.height.equalTo(@112);
  22. }];
  23. [self.contentView addSubview:self.titleLb];
  24. [self.titleLb mas_makeConstraints:^(MASConstraintMaker *make) {
  25. make.bottom.equalTo(self.contentView).offset(-16);
  26. make.leading.equalTo(self.contentView).offset(18);
  27. make.trailing.equalTo(self.contentView).offset(-18);
  28. }];
  29. }
  30. - (UIImageView *)imgV {
  31. if (!_imgV) {
  32. UIImageView *imgV = [UIImageView baseImgV];
  33. imgV.contentMode = UIViewContentModeScaleAspectFill;
  34. imgV.clipsToBounds = true;
  35. imgV.layer.cornerRadius = 56;
  36. imgV.layer.masksToBounds = true;
  37. _imgV = imgV;
  38. }
  39. return _imgV;
  40. }
  41. - (UILabel *)titleLb {
  42. if (!_titleLb) {
  43. UILabel *lb = [UILabel baseLb];
  44. lb.textColor = Col_FFF;
  45. lb.font = [UIFont fontWithName:Rob_Bold size:12];
  46. lb.textAlignment = NSTextAlignmentCenter;
  47. lb.numberOfLines = 2;
  48. _titleLb = lb;
  49. }
  50. return _titleLb;
  51. }
  52. @end