CoachArrangeClassCell.m 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. //
  2. // CoachArrangeClassCell.m
  3. // LN_School
  4. //
  5. // Created by 张嵘 on 2019/8/1.
  6. // Copyright © 2019 Danson. All rights reserved.
  7. //
  8. #import "CoachArrangeClassCell.h"
  9. #import "CoachArrangeClassModel.h"
  10. @interface CoachArrangeClassCell ()
  11. @property (nonatomic, readwrite, strong) UILabel *progressLabel;
  12. @property (nonatomic, readwrite, strong) UILabel *objectLabel;
  13. @property (nonatomic, readwrite, strong) UILabel *dateLabel;
  14. @end
  15. @implementation CoachArrangeClassCell
  16. #pragma mark - Life Cycle
  17. - (instancetype)initWithFrame:(CGRect)frame {
  18. self = [super initWithFrame:frame];
  19. if (self) {
  20. self.contentView.backgroundColor = UIColor.whiteColor;
  21. [self.contentView addSubview:self.progressLabel];
  22. [self.contentView addSubview:self.objectLabel];
  23. [self.contentView addSubview:self.dateLabel];
  24. }
  25. return self;
  26. }
  27. - (void)layoutSubviews {
  28. [super layoutSubviews];
  29. [_progressLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  30. make.center.mas_equalTo(self.contentView);
  31. make.size.mas_equalTo(CGSizeMake(self.bounds.size.width / 3.f, self.bounds.size.height));
  32. }];
  33. [_dateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  34. make.left.mas_offset(0);
  35. make.centerY.mas_equalTo(self.contentView);
  36. make.size.mas_equalTo(_progressLabel);
  37. }];
  38. [_objectLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  39. make.right.mas_offset(0);
  40. make.centerY.mas_equalTo(self.contentView);
  41. make.size.mas_equalTo(_progressLabel);
  42. }];
  43. }
  44. #pragma mark - HDUpdateUIProtocol
  45. - (void)updateCellUI:(__kindof HDCellModel *)model {
  46. CoachArrangeClassModel *coachArrangeClassModel = model.orgData;
  47. _progressLabel.text = [NSString stringWithFormat:@"%@", coachArrangeClassModel.progress];
  48. _objectLabel.text = [NSString stringWithFormat:@"%@", coachArrangeClassModel.object];
  49. _dateLabel.text = [NSString stringWithFormat:@"%@", coachArrangeClassModel.date];
  50. }
  51. #pragma mark - Lazy Load
  52. - (UILabel *)progressLabel {
  53. if (!_progressLabel) {
  54. _progressLabel = [[UILabel alloc] init];
  55. _progressLabel.text = @"阶段三";
  56. _progressLabel.textAlignment = NSTextAlignmentCenter;
  57. _progressLabel.textColor = RQTitleTextColor;
  58. _progressLabel.numberOfLines = 0;
  59. _progressLabel.font = [UIFont systemFontOfSize:16];
  60. }
  61. return _progressLabel;
  62. }
  63. - (UILabel *)objectLabel {
  64. if (!_objectLabel) {
  65. _objectLabel = [[UILabel alloc] init];
  66. _objectLabel.text = @"实际操作";
  67. _objectLabel.textAlignment = NSTextAlignmentCenter;
  68. _objectLabel.textColor = RQTitleTextColor;
  69. _objectLabel.numberOfLines = 0;
  70. _objectLabel.font = [UIFont systemFontOfSize:16];
  71. }
  72. return _objectLabel;
  73. }
  74. - (UILabel *)dateLabel {
  75. if (!_dateLabel) {
  76. _dateLabel = [[UILabel alloc] init];
  77. _dateLabel.text = @"2019-09-09";
  78. _dateLabel.textAlignment = NSTextAlignmentCenter;
  79. _dateLabel.textColor = RQTitleTextColor;
  80. _dateLabel.numberOfLines = 0;
  81. _dateLabel.font = [UIFont systemFontOfSize:16];
  82. }
  83. return _dateLabel;
  84. }
  85. @end