ASHomeTipCollectCell.m 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. //
  2. // ASHomeTipCollectCell.m
  3. // Asteria
  4. //
  5. // Created by iOS on 2023/6/6.
  6. //
  7. #import "ASHomeTipCollectCell.h"
  8. @implementation ASHomeTipCollectCell
  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 = _F5F5F5;
  18. self.contentView.layer.masksToBounds = true;
  19. self.contentView.layer.cornerRadius = 4;
  20. [self.contentView addSubview:self.imgV];
  21. [self.contentView addSubview:self.titleLb];
  22. [self.imgV mas_makeConstraints:^(MASConstraintMaker *make) {
  23. make.top.equalTo(self.titleLb);
  24. make.trailing.equalTo(self.titleLb.mas_leading).offset(-10);
  25. // make.top.leading.equalTo(self.contentView).offset(10);
  26. make.width.height.equalTo(@24);
  27. }];
  28. [self.titleLb mas_makeConstraints:^(MASConstraintMaker *make) {
  29. make.centerX.equalTo(self.contentView).offset(17);
  30. make.centerY.equalTo(self.contentView);
  31. make.width.equalTo(@120);
  32. make.height.equalTo(@34);
  33. // make.leading.equalTo(self.imgV.mas_trailing).offset(10);
  34. // make.top.equalTo(self.imgV);
  35. // make.trailing.equalTo(self.contentView).offset(-5);
  36. // make.bottom.equalTo(self.contentView).offset(-5);
  37. }];
  38. }
  39. - (UIImageView *)imgV {
  40. if (!_imgV) {
  41. UIImageView *imgV = [UIImageView baseImgV];
  42. imgV.contentMode = UIViewContentModeScaleAspectFit;
  43. _imgV = imgV;
  44. }
  45. return _imgV;
  46. }
  47. - (UILabel *)titleLb {
  48. if (!_titleLb) {
  49. UILabel *lb = [UILabel baseLb];
  50. lb.textColor = Col_000;
  51. lb.font = [UIFont fontWithName:Rob_Regular size:12];
  52. lb.textAlignment = NSTextAlignmentLeft;
  53. lb.numberOfLines = 0;
  54. lb.lineBreakMode = NSLineBreakByWordWrapping;
  55. lb.qmui_lineHeight = 17;
  56. _titleLb = lb;
  57. }
  58. return _titleLb;
  59. }
  60. @end