CoachArrangeClassHeaderView.m 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. //
  2. // CoachArrangeClassHeaderView.m
  3. // LN_School
  4. //
  5. // Created by 张嵘 on 2019/8/1.
  6. // Copyright © 2019 Danson. All rights reserved.
  7. //
  8. #import "CoachArrangeClassHeaderView.h"
  9. @interface CoachArrangeClassHeaderView ()
  10. @property (nonatomic, readwrite, strong) UILabel *progressLabel;
  11. @property (nonatomic, readwrite, strong) UILabel *objectLabel;
  12. @property (nonatomic, readwrite, strong) UILabel *dateLabel;
  13. @end
  14. @implementation CoachArrangeClassHeaderView
  15. #pragma mark - Life Cycle
  16. - (instancetype)initWithFrame:(CGRect)frame {
  17. self = [super initWithFrame:frame];
  18. if (self) {
  19. self.backgroundColor = RQBackGroundColor;
  20. [self addSubview:self.progressLabel];
  21. [self addSubview:self.objectLabel];
  22. [self addSubview:self.dateLabel];
  23. }
  24. return self;
  25. }
  26. - (void)layoutSubviews {
  27. [super layoutSubviews];
  28. [_progressLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  29. make.center.mas_equalTo(self);
  30. make.size.mas_equalTo(CGSizeMake(self.bounds.size.width / 3.f, self.bounds.size.height));
  31. }];
  32. [_dateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  33. make.left.mas_offset(0);
  34. make.centerY.mas_equalTo(self);
  35. make.size.mas_equalTo(_progressLabel);
  36. }];
  37. [_objectLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  38. make.right.mas_offset(0);
  39. make.centerY.mas_equalTo(self);
  40. make.size.mas_equalTo(_progressLabel);
  41. }];
  42. }
  43. #pragma mark - Lazy Load
  44. - (UILabel *)progressLabel {
  45. if (!_progressLabel) {
  46. _progressLabel = [[UILabel alloc] init];
  47. _progressLabel.text = @"进度";
  48. _progressLabel.textAlignment = NSTextAlignmentCenter;
  49. _progressLabel.textColor = RQContentTextColor;
  50. _progressLabel.numberOfLines = 0;
  51. _progressLabel.font = [UIFont systemFontOfSize:16];
  52. }
  53. return _progressLabel;
  54. }
  55. - (UILabel *)objectLabel {
  56. if (!_objectLabel) {
  57. _objectLabel = [[UILabel alloc] init];
  58. _objectLabel.text = @"项目";
  59. _objectLabel.textAlignment = NSTextAlignmentCenter;
  60. _objectLabel.textColor = RQContentTextColor;
  61. _objectLabel.numberOfLines = 0;
  62. _objectLabel.font = [UIFont systemFontOfSize:16];
  63. }
  64. return _objectLabel;
  65. }
  66. - (UILabel *)dateLabel {
  67. if (!_dateLabel) {
  68. _dateLabel = [[UILabel alloc] init];
  69. _dateLabel.text = @"日期";
  70. _dateLabel.textAlignment = NSTextAlignmentCenter;
  71. _dateLabel.textColor = RQContentTextColor;
  72. _dateLabel.numberOfLines = 0;
  73. _dateLabel.font = [UIFont systemFontOfSize:16];
  74. }
  75. return _dateLabel;
  76. }
  77. @end