YXBottomItemView.m 1.4 KB

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