123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190 |
- //
- // ExamArrangeCell.m
- // LN_School
- //
- // Created by 张嵘 on 2019/7/29.
- // Copyright © 2019 Danson. All rights reserved.
- //
- #import "ExamArrangeCell.h"
- #import "ExamArrangeModel.h"
- @interface ExamArrangeCell ()
- @property (nonatomic, readwrite, strong) UILabel *timeLabel;
- @property (nonatomic, readwrite, strong) YYLabel *passNumLabel;
- @property (nonatomic, readwrite, strong) UIImageView *centerLineView;
- @property (nonatomic, readwrite, strong) UILabel *objectLabel;
- @property (nonatomic, readwrite, strong) UILabel *carTyepLabel;
- @property (nonatomic, readwrite, strong) YYLabel *signatureLabel;
- @property (nonatomic, readwrite, strong) UILabel *examNumLabel;
- @end
- @implementation ExamArrangeCell
- #pragma mark - Life Cycle
- - (instancetype)initWithFrame:(CGRect)frame {
- self = [super initWithFrame:frame];
- if (self) {
- self.contentView.backgroundColor = UIColor.whiteColor;
- [self.contentView addSubview:self.timeLabel];
- [self.contentView addSubview:self.passNumLabel];
- [self.contentView addSubview:self.centerLineView];
- [self.contentView addSubview:self.objectLabel];
- [self.contentView addSubview:self.carTyepLabel];
- [self.contentView addSubview:self.signatureLabel];
- [self.contentView addSubview:self.examNumLabel];
- }
- return self;
- }
- - (void)layoutSubviews {
- [super layoutSubviews];
-
- [_timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.left.mas_offset(16);
- make.size.mas_equalTo(CGSizeMake((self.bounds.size.width - 16 * 3) * (2.f / 3.f), (self.bounds.size.height - 5 * 16) / 3.f));
- }];
-
- [_passNumLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_offset(16);
- make.right.mas_equalTo(-16);
- make.size.mas_equalTo(CGSizeMake((self.bounds.size.width - 16 * 3) * (1.f / 3.f), (self.bounds.size.height - 5 * 16) / 3.f));
- }];
-
- [_centerLineView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(_timeLabel.mas_bottom).mas_offset(16);
- make.left.mas_equalTo(_timeLabel);
- make.right.mas_offset(0);
- make.height.mas_equalTo(1);
- }];
-
- [_objectLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(_centerLineView.mas_bottom).mas_offset(16);
- make.left.mas_equalTo(_timeLabel);
- make.size.mas_equalTo(CGSizeMake((self.bounds.size.width - 16 * 3) * (1.f / 2.f), (self.bounds.size.height - 5 * 16) / 3.f));
- }];
-
- [_carTyepLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(_objectLabel);
- make.right.mas_offset(-16);
- make.size.mas_equalTo(_objectLabel);
- }];
-
- [_signatureLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(_objectLabel.mas_bottom).mas_offset(16);
- make.left.mas_equalTo(_objectLabel);
- make.size.mas_equalTo(_objectLabel);
- }];
-
- [_examNumLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(_carTyepLabel.mas_bottom).mas_offset(16);
- make.right.mas_equalTo(-16);
- make.size.mas_equalTo(_objectLabel);
- }];
- }
- #pragma mark - HDUpdateUIProtocol
- - (void)updateCellUI:(__kindof HDCellModel *)model {
- ExamArrangeModel *examArrangeModel = model.orgData;
- self.timeLabel.text = [NSString stringWithFormat:@"考试时间:%@", examArrangeModel.date];
- self.passNumLabel.text = [NSString stringWithFormat:@"通过:%@", examArrangeModel.passNum];
- self.objectLabel.text = [NSString stringWithFormat:@"科目:%@", examArrangeModel.object];
- self.carTyepLabel.text = [NSString stringWithFormat:@"车型:%@", examArrangeModel.carType];
- self.signatureLabel.text = [NSString stringWithFormat:@"签章:%@",examArrangeModel.signature];
- self.examNumLabel.text = [NSString stringWithFormat:@"排考:%@", examArrangeModel.examNum];
- NSMutableAttributedString *remarkLabelAttStr = [[NSMutableAttributedString alloc] initWithString:self.passNumLabel.text];
- remarkLabelAttStr.yy_color = RQGreenColor;
- [remarkLabelAttStr yy_setColor:RQGreenColor range:[self.passNumLabel.text rangeOfString:self.passNumLabel.text]];
- remarkLabelAttStr.yy_font = [UIFont systemFontOfSize:16];
- remarkLabelAttStr.yy_alignment = NSTextAlignmentRight;
- _passNumLabel.attributedText = remarkLabelAttStr;
- }
- #pragma mark - Lazy Load
- - (UILabel *)timeLabel {
- if (!_timeLabel) {
- _timeLabel = [[UILabel alloc] init];
- _timeLabel.text = @"考试时间:2019-09-09";
- _timeLabel.textAlignment = NSTextAlignmentLeft;
- _timeLabel.textColor = RQContentTextColor;
- _timeLabel.numberOfLines = 0;
- _timeLabel.font = [UIFont systemFontOfSize:16];
- }
- return _timeLabel;
- }
- - (UIImageView *)centerLineView {
- if (!_centerLineView) {
- _centerLineView = [[UIImageView alloc] init];
- _centerLineView.backgroundColor = RQBackGroundColor;
- }
- return _centerLineView;
- }
- - (UILabel *)objectLabel {
- if (!_objectLabel) {
- _objectLabel = [[UILabel alloc] init];
- _objectLabel.text = @"科目:l科目一";
- _objectLabel.textAlignment = NSTextAlignmentLeft;
- _objectLabel.textColor = RQTitleTextColor;
- _objectLabel.numberOfLines = 0;
- _objectLabel.font = [UIFont systemFontOfSize:16];
- }
- return _objectLabel;
- }
- - (UILabel *)carTyepLabel {
- if (!_carTyepLabel) {
- _carTyepLabel = [[UILabel alloc] init];
- _carTyepLabel.text = @"车型:C1";
- _carTyepLabel.textAlignment = NSTextAlignmentRight;
- _carTyepLabel.textColor = RQTitleTextColor;
- _carTyepLabel.numberOfLines = 0;
- _carTyepLabel.font = [UIFont systemFontOfSize:16];
- }
- return _carTyepLabel;
- }
- - (UILabel *)examNumLabel {
- if (!_examNumLabel) {
- _examNumLabel = [[UILabel alloc] init];
- _examNumLabel.text = @"拍考数:0";
- _examNumLabel.textAlignment = NSTextAlignmentRight;
- _examNumLabel.textColor = RQTitleTextColor;
- _examNumLabel.numberOfLines = 0;
- _examNumLabel.font = [UIFont systemFontOfSize:16];
- }
- return _examNumLabel;
- }
- - (YYLabel *)passNumLabel {
- if (!_passNumLabel) {
- _passNumLabel = [[YYLabel alloc] init];
- _passNumLabel.text = @"通过数量:0";
- _passNumLabel.textAlignment = NSTextAlignmentLeft;
- _passNumLabel.textColor = RQTitleTextColor;
- _passNumLabel.numberOfLines = 0;
- _passNumLabel.font = [UIFont systemFontOfSize:16];
- }
- return _passNumLabel;
- }
- - (YYLabel *)signatureLabel {
- if (!_signatureLabel) {
- _signatureLabel = [[YYLabel alloc] init];
- _signatureLabel.text = @"通过率:0%";
- _signatureLabel.textAlignment = NSTextAlignmentLeft;
- _signatureLabel.textColor = RQTitleTextColor;
- _signatureLabel.numberOfLines = 0;
- _signatureLabel.font = [UIFont systemFontOfSize:16];
- }
- return _signatureLabel;
- }
- @end
|