YXFindItemView.m 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. //
  2. // YXFindItemView.m
  3. // Temperature
  4. //
  5. // Created by TC on 2025/4/9.
  6. //
  7. #import "YXFindItemView.h"
  8. @implementation YXFindItemView
  9. - (instancetype)init
  10. {
  11. self = [super init];
  12. if (self) {
  13. [self setItemSubViews];
  14. }
  15. return self;
  16. }
  17. -(void)setItemSubViews
  18. {
  19. UIImageView *picView = [[UIImageView alloc]init];
  20. [self addSubview:picView];
  21. [picView mas_makeConstraints:^(MASConstraintMaker *make) {
  22. make.centerX.equalTo(self.mas_centerX);
  23. make.top.equalTo(@5);
  24. make.width.equalTo(@40);
  25. make.height.equalTo(@40);
  26. }];
  27. self.picImgView = picView;
  28. UILabel *textLabel = [[UILabel alloc]init];
  29. textLabel.font = [UIFont systemFontOfSize:14];
  30. textLabel.textAlignment = NSTextAlignmentCenter;
  31. textLabel.textColor = [UIColor colorWithHexString:@"#333333"];
  32. [self addSubview:textLabel];
  33. [textLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  34. make.top.equalTo(picView.mas_bottom);
  35. make.left.equalTo(@5);
  36. make.right.equalTo(@-5);
  37. make.bottom.equalTo(@0);
  38. }];
  39. self.textLabel = textLabel;
  40. }
  41. /*
  42. // Only override drawRect: if you perform custom drawing.
  43. // An empty implementation adversely affects performance during animation.
  44. - (void)drawRect:(CGRect)rect {
  45. // Drawing code
  46. }
  47. */
  48. @end