YXEmptyView.m 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. //
  2. // YXEmptyView.m
  3. // Temperature
  4. //
  5. // Created by TC on 2025/4/23.
  6. //
  7. #import "YXEmptyView.h"
  8. @implementation YXEmptyView
  9. - (instancetype)init
  10. {
  11. self = [super init];
  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.top.equalTo(@20);
  24. make.centerX.equalTo(self.mas_centerX);
  25. make.width.equalTo(@150);
  26. make.height.equalTo(@150);
  27. }];
  28. self.picImgView = picView;
  29. UILabel *textLabel = [[UILabel alloc]init];
  30. textLabel.font = [UIFont systemFontOfSize:14];
  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).offset(50);
  37. make.width.equalTo(@150);
  38. make.height.equalTo(@30);
  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