ASSignDayView.m 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. //
  2. // ASSignDayView.m
  3. // Asteria
  4. //
  5. // Created by iOS on 2023/5/16.
  6. //
  7. #import "ASSignDayView.h"
  8. @implementation ASSignDayView
  9. - (void)setDay:(NSInteger)day st:(NSInteger)isSgin {
  10. self.dayLb.text = [NSString stringWithFormat:@"D%ld", day];
  11. if (isSgin == 2) {
  12. self.dayLb.textColor = Col_000;
  13. self.statusImgV.image = [UIImage imageNamed:@"sd_signed"];
  14. } else {
  15. if (isSgin == 1) {
  16. self.dayLb.textColor = Col_666;
  17. self.statusImgV.image = [UIImage imageNamed:@"sd_waitSign"];
  18. } else {
  19. self.dayLb.textColor = Col_999;
  20. self.statusImgV.image = [UIImage imageNamed:@"sd_tomorrowSign"];
  21. }
  22. }
  23. }
  24. - (instancetype)initWithFrame:(CGRect)frame {
  25. self = [super initWithFrame:frame];
  26. if (self) {
  27. [self configSubV];
  28. }
  29. return self;
  30. }
  31. - (void)configSubV {
  32. self.backgroundColor = UIColor.clearColor;
  33. [self addSubview:self.dayLb];
  34. [self addSubview:self.statusImgV];
  35. [self.dayLb mas_makeConstraints:^(MASConstraintMaker *make) {
  36. make.top.leading.trailing.equalTo(self);
  37. make.width.equalTo(@30);
  38. make.height.equalTo(@14);
  39. }];
  40. [self.statusImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  41. make.width.height.equalTo(@11);
  42. make.bottom.equalTo(self);
  43. make.centerX.equalTo(self);
  44. make.top.equalTo(self.dayLb.mas_bottom).offset(8);
  45. }];
  46. }
  47. - (UILabel *)dayLb {
  48. if (!_dayLb) {
  49. UILabel *lb = [UILabel baseLb];
  50. lb.font = [UIFont fontWithName:Rob_Regular size:12];
  51. lb.textColor = Col_000;
  52. lb.textAlignment = NSTextAlignmentCenter;
  53. _dayLb = lb;
  54. }
  55. return _dayLb;
  56. }
  57. - (UIImageView *)statusImgV {
  58. if (!_statusImgV) {
  59. UIImageView *img = [UIImageView baseImgV];
  60. _statusImgV = img;
  61. }
  62. return _statusImgV;
  63. }
  64. @end