123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- //
- // TrainSummaryHoursRequirementsCell.m
- // LN_School
- //
- // Created by 张嵘 on 2019/7/28.
- // Copyright © 2019 Danson. All rights reserved.
- //
- #import "TrainSummaryHoursRequirementsCell.h"
- @interface TrainSummaryHoursRequirementsCell ()
- @property (nonatomic, readwrite, strong) UILabel *stageLabel;
- @property (nonatomic, readwrite, strong) UILabel *totalHoursLabel;
- @property (nonatomic, readwrite, strong) UIImageView *centerLineView;
- @property (nonatomic, readwrite, strong) UILabel *theoryHoursLabel;
- @property (nonatomic, readwrite, strong) UILabel *practicalOperationHoursLabel;
- @property (nonatomic, readwrite, strong) UILabel *simulateHoursLabel;
- @property (nonatomic, readwrite, strong) UILabel *assessmentHoursLabel;
- @end
- @implementation TrainSummaryHoursRequirementsCell
- #pragma mark - Life Cycle
- - (instancetype)initWithFrame:(CGRect)frame {
- self = [super initWithFrame:frame];
- if (self) {
- self.contentView.backgroundColor = UIColor.whiteColor;
- [self.contentView addSubview:self.stageLabel];
- [self.contentView addSubview:self.totalHoursLabel];
- [self.contentView addSubview:self.centerLineView];
- [self.contentView addSubview:self.theoryHoursLabel];
- [self.contentView addSubview:self.practicalOperationHoursLabel];
- [self.contentView addSubview:self.simulateHoursLabel];
- [self.contentView addSubview:self.assessmentHoursLabel];
- }
- return self;
- }
- - (void)layoutSubviews {
- [super layoutSubviews];
-
- [_stageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.left.mas_offset(16);
- make.size.mas_equalTo(CGSizeMake((self.bounds.size.width - 16 * 3) * 0.5, (self.bounds.size.height - 5 * 16) / 3.f));
- }];
-
- [_totalHoursLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(_stageLabel);
- make.right.mas_offset(-16);
- make.size.mas_equalTo(_stageLabel);
- }];
-
- [_centerLineView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(_stageLabel.mas_bottom).mas_offset(16);
- make.left.mas_equalTo(_stageLabel);
- make.right.mas_offset(0);
- make.height.mas_equalTo(1);
- }];
- [_theoryHoursLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(_centerLineView.mas_bottom).mas_offset(16);
- make.left.mas_equalTo(_stageLabel);
- make.size.mas_equalTo(_stageLabel);
- }];
-
- [_practicalOperationHoursLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(_theoryHoursLabel);
- make.right.mas_offset(-16);
- make.size.mas_equalTo(_stageLabel);
- }];
-
- [_simulateHoursLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(_theoryHoursLabel.mas_bottom).mas_offset(16);
- make.left.mas_equalTo(_stageLabel);
- make.size.mas_equalTo(_stageLabel);
- }];
-
- [_assessmentHoursLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(_simulateHoursLabel);
- make.right.mas_offset(-16);
- make.size.mas_equalTo(_stageLabel);
- }];
-
- }
- #pragma mark - HDUpdateUIProtocol
- - (void)updateCellUI:(__kindof HDCellModel *)model {
- // TrainRecordModel *trainRecordModel = model.orgData;
- // [self.headImageView sd_setImageWithURL:[NSURL URLWithString:trainRecordModel.url? : @""] placeholderImage:[UIImage imageNamed:@"HeaderPlacehold"]];
- // self.timeLabel.text = [NSString stringWithFormat:@"时间:%@",trainRecordModel.time];
- // self.stageLabel.text = [NSString stringWithFormat:@"阶段:%@",trainRecordModel.stage];
- // self.driverObjectLabel.text = [NSString stringWithFormat:@"类型:%@",trainRecordModel.object];
- // self.driverHoursLabel.text = [NSString stringWithFormat:@"学时:%@",trainRecordModel.hour];
- }
- #pragma mark - Lazy Load
- - (UILabel *)stageLabel {
- if (!_stageLabel) {
- _stageLabel = [[UILabel alloc] init];
- _stageLabel.text = @"阶段三";
- _stageLabel.textAlignment = NSTextAlignmentLeft;
- _stageLabel.textColor = RQSubColor;
- _stageLabel.numberOfLines = 0;
- _stageLabel.font = [UIFont systemFontOfSize:16];
- }
- return _stageLabel;
- }
- - (UILabel *)totalHoursLabel {
- if (!_totalHoursLabel) {
- _totalHoursLabel = [[UILabel alloc] init];
- _totalHoursLabel.text = @"合计:100";
- _totalHoursLabel.textAlignment = NSTextAlignmentRight;
- _totalHoursLabel.textColor = RQGreenColor;
- _totalHoursLabel.numberOfLines = 0;
- _totalHoursLabel.font = [UIFont systemFontOfSize:16];
- }
- return _totalHoursLabel;
- }
- - (UIImageView *)centerLineView {
- if (!_centerLineView) {
- _centerLineView = [[UIImageView alloc] init];
- _centerLineView.backgroundColor = RQBackGroundColor;
- }
- return _centerLineView;
- }
- - (UILabel *)theoryHoursLabel {
- if (!_theoryHoursLabel) {
- _theoryHoursLabel = [[UILabel alloc] init];
- _theoryHoursLabel.text = @"理论:25";
- _theoryHoursLabel.textAlignment = NSTextAlignmentLeft;
- _theoryHoursLabel.textColor = RQTitleTextColor;
- _theoryHoursLabel.numberOfLines = 0;
- _theoryHoursLabel.font = [UIFont systemFontOfSize:16];
- }
- return _theoryHoursLabel;
- }
- - (UILabel *)practicalOperationHoursLabel {
- if (!_practicalOperationHoursLabel) {
- _practicalOperationHoursLabel = [[UILabel alloc] init];
- _practicalOperationHoursLabel.text = @"实操:25";
- _practicalOperationHoursLabel.textAlignment = NSTextAlignmentRight;
- _practicalOperationHoursLabel.textColor = RQTitleTextColor;
- _practicalOperationHoursLabel.numberOfLines = 0;
- _practicalOperationHoursLabel.font = [UIFont systemFontOfSize:16];
- }
- return _practicalOperationHoursLabel;
- }
- - (UILabel *)simulateHoursLabel {
- if (!_simulateHoursLabel) {
- _simulateHoursLabel = [[UILabel alloc] init];
- _simulateHoursLabel.text = @"模拟:25";
- _simulateHoursLabel.textAlignment = NSTextAlignmentLeft;
- _simulateHoursLabel.textColor = RQTitleTextColor;
- _simulateHoursLabel.numberOfLines = 0;
- _simulateHoursLabel.font = [UIFont systemFontOfSize:16];
- }
- return _simulateHoursLabel;
- }
- - (UILabel *)assessmentHoursLabel {
- if (!_assessmentHoursLabel) {
- _assessmentHoursLabel = [[UILabel alloc] init];
- _assessmentHoursLabel.text = @"考核:25";
- _assessmentHoursLabel.textAlignment = NSTextAlignmentRight;
- _assessmentHoursLabel.textColor = RQTitleTextColor;
- _assessmentHoursLabel.numberOfLines = 0;
- _assessmentHoursLabel.font = [UIFont systemFontOfSize:16];
- }
- return _assessmentHoursLabel;
- }
- @end
|