TrainSummaryHeaderView.m 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. //
  2. // TrainSummaryHeaderView.m
  3. // LN_School
  4. //
  5. // Created by 张嵘 on 2019/7/26.
  6. // Copyright © 2019 Danson. All rights reserved.
  7. //
  8. #import "TrainSummaryHeaderView.h"
  9. @interface TrainSummaryHeaderView ()
  10. @property (nonatomic, readwrite, strong) UIView *contentView;
  11. @property (nonatomic, readwrite, strong) UILabel *carTypeTitleLabel;
  12. @property (nonatomic, readwrite, strong) UILabel *carTypeContentLabel;
  13. @property (nonatomic, readwrite, strong) UILabel *driverHoursTitleLabel;
  14. @property (nonatomic, readwrite, strong) UILabel *driverHoursContentLabel;
  15. @property (nonatomic, readwrite, strong) UIImageView *centerLineView;
  16. @end
  17. @implementation TrainSummaryHeaderView
  18. #pragma mark - Life Cycle
  19. - (instancetype)initWithFrame:(CGRect)frame {
  20. self = [super initWithFrame:frame];
  21. if (self) {
  22. self.backgroundColor = RQMianColor;
  23. [self addSubview:self.contentView];
  24. [self.contentView addSubview:self.carTypeTitleLabel];
  25. [self.contentView addSubview:self.carTypeContentLabel];
  26. [self.contentView addSubview:self.driverHoursTitleLabel];
  27. [self.contentView addSubview:self.driverHoursContentLabel];
  28. [self.contentView addSubview:self.centerLineView];
  29. }
  30. return self;
  31. }
  32. - (void)layoutSubviews {
  33. [super layoutSubviews];
  34. [_contentView mas_makeConstraints:^(MASConstraintMaker *make) {
  35. make.center.mas_equalTo(self);
  36. make.size.mas_equalTo(CGSizeMake(self.bounds.size.width, self.bounds.size.height * 2.f / 3.f));
  37. }];
  38. [_carTypeTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  39. make.top.left.mas_offset(0);
  40. make.size.mas_equalTo(CGSizeMake(self.bounds.size.width * 0.5, self.bounds.size.height / 3.f));
  41. }];
  42. [_carTypeContentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  43. make.left.bottom.mas_offset(0);
  44. make.size.mas_equalTo(_carTypeTitleLabel);
  45. }];
  46. [_driverHoursTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  47. make.top.right.mas_offset(0);
  48. make.size.mas_equalTo(_carTypeTitleLabel);
  49. }];
  50. [_driverHoursContentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  51. make.bottom.right.mas_offset(0);
  52. make.size.mas_equalTo(_carTypeTitleLabel);
  53. }];
  54. [_centerLineView mas_makeConstraints:^(MASConstraintMaker *make) {
  55. make.center.mas_equalTo(_contentView);
  56. make.size.mas_equalTo(CGSizeMake(1, self.bounds.size.height / 3.f));
  57. }];
  58. }
  59. #pragma mark - HDUpdateUIProtocol
  60. - (void)updateCellUI:(__kindof HDCellModel *)model {
  61. // TrainRecordModel *trainRecordModel = model.orgData;
  62. // [self.headImageView sd_setImageWithURL:[NSURL URLWithString:trainRecordModel.url? : @""] placeholderImage:[UIImage imageNamed:@"HeaderPlacehold"]];
  63. // self.timeLabel.text = [NSString stringWithFormat:@"时间:%@",trainRecordModel.time];
  64. // self.stageLabel.text = [NSString stringWithFormat:@"阶段:%@",trainRecordModel.stage];
  65. // self.driverObjectLabel.text = [NSString stringWithFormat:@"类型:%@",trainRecordModel.object];
  66. // self.driverHoursLabel.text = [NSString stringWithFormat:@"学时:%@",trainRecordModel.hour];
  67. }
  68. #pragma mark - Lazy Load
  69. - (UIView *)contentView {
  70. if (!_contentView) {
  71. _contentView = [[UIView alloc] init];
  72. _contentView.backgroundColor = RQMianColor;
  73. }
  74. return _contentView;
  75. }
  76. - (UILabel *)carTypeTitleLabel {
  77. if (!_carTypeTitleLabel) {
  78. _carTypeTitleLabel = [[UILabel alloc] init];
  79. _carTypeTitleLabel.text = @"培训车型";
  80. _carTypeTitleLabel.textAlignment = NSTextAlignmentCenter;
  81. _carTypeTitleLabel.textColor = UIColor.whiteColor;
  82. _carTypeTitleLabel.numberOfLines = 0;
  83. _carTypeTitleLabel.font = [UIFont systemFontOfSize:18];
  84. }
  85. return _carTypeTitleLabel;
  86. }
  87. - (UILabel *)carTypeContentLabel {
  88. if (!_carTypeContentLabel) {
  89. _carTypeContentLabel = [[UILabel alloc] init];
  90. _carTypeContentLabel.text = @"C1";
  91. _carTypeContentLabel.textAlignment = NSTextAlignmentCenter;
  92. _carTypeContentLabel.textColor = UIColor.whiteColor;
  93. _carTypeContentLabel.numberOfLines = 0;
  94. _carTypeContentLabel.font = [UIFont systemFontOfSize:18];
  95. }
  96. return _carTypeContentLabel;
  97. }
  98. - (UILabel *)driverHoursTitleLabel {
  99. if (!_driverHoursTitleLabel) {
  100. _driverHoursTitleLabel = [[UILabel alloc] init];
  101. _driverHoursTitleLabel.text = @"培训学时";
  102. _driverHoursTitleLabel.textAlignment = NSTextAlignmentCenter;
  103. _driverHoursTitleLabel.textColor = UIColor.whiteColor;
  104. _driverHoursTitleLabel.numberOfLines = 0;
  105. _driverHoursTitleLabel.font = [UIFont systemFontOfSize:18];
  106. }
  107. return _driverHoursTitleLabel;
  108. }
  109. - (UILabel *)driverHoursContentLabel {
  110. if (!_driverHoursContentLabel) {
  111. _driverHoursContentLabel = [[UILabel alloc] init];
  112. _driverHoursContentLabel.text = @"62";
  113. _driverHoursContentLabel.textAlignment = NSTextAlignmentCenter;
  114. _driverHoursContentLabel.textColor = UIColor.whiteColor;
  115. _driverHoursContentLabel.numberOfLines = 0;
  116. _driverHoursContentLabel.font = [UIFont systemFontOfSize:18];
  117. }
  118. return _driverHoursContentLabel;
  119. }
  120. - (UIImageView *)centerLineView {
  121. if (!_centerLineView) {
  122. _centerLineView = [[UIImageView alloc] init];
  123. _centerLineView.backgroundColor = RQColorFromHexString(@"6482cf");
  124. }
  125. return _centerLineView;
  126. }
  127. @end