123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224 |
- //
- // PreExamMarkCell.m
- // LN_School
- //
- // Created by 张嵘 on 2019/7/31.
- // Copyright © 2019 Danson. All rights reserved.
- //
- #import "PreExamMarkCell.h"
- #import "PreExamMarkModel.h"
- @interface PreExamMarkCell ()
- @property (nonatomic, readwrite, strong) UILabel *studentNameLabel;
- @property (nonatomic, readwrite, strong) YYLabel *passStatusLabel;
- @property (nonatomic, readwrite, strong) UIImageView *centerLineView;
- @property (nonatomic, readwrite, strong) UIImageView *coachIconImageView;
- @property (nonatomic, readwrite, strong) UILabel *coachLabel;
- @property (nonatomic, readwrite, strong) UIImageView *objectIconImageView;
- @property (nonatomic, readwrite, strong) UILabel *objectLabel;
- @property (nonatomic, readwrite, strong) UILabel *objectScoreLabel;
- @property (nonatomic, readwrite, strong) UIImageView *dateIconImageView;
- @property (nonatomic, readwrite, strong) UILabel *dateLabel;
- @end
- @implementation PreExamMarkCell
- #pragma mark - Life Cycle
- - (instancetype)initWithFrame:(CGRect)frame {
- self = [super initWithFrame:frame];
- if (self) {
- self.contentView.backgroundColor = UIColor.whiteColor;
- [self.contentView addSubview:self.studentNameLabel];
- [self.contentView addSubview:self.passStatusLabel];
- [self.contentView addSubview:self.centerLineView];
- [self.contentView addSubview:self.coachIconImageView];
- [self.contentView addSubview:self.coachLabel];
- [self.contentView addSubview:self.objectIconImageView];
- [self.contentView addSubview:self.objectLabel];
- [self.contentView addSubview:self.objectScoreLabel];
- [self.contentView addSubview:self.dateIconImageView];
- [self.contentView addSubview:self.dateLabel];
- }
- return self;
- }
- - (void)layoutSubviews {
- [super layoutSubviews];
-
- [_studentNameLabel 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 - 6 * 16) / 3.f));
- }];
-
- [_passStatusLabel 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 - 6 * 16) / 3.f));
- }];
-
- [_centerLineView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(_studentNameLabel.mas_bottom).mas_offset(16);
- make.left.mas_equalTo(_studentNameLabel);
- make.right.mas_offset(0);
- make.height.mas_equalTo(1);
- }];
-
- [_coachIconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(_centerLineView.mas_bottom).mas_offset(16);
- make.left.mas_equalTo(_studentNameLabel);
- make.size.mas_equalTo(CGSizeMake((self.bounds.size.height - 6 * 16) / 5.f , (self.bounds.size.height - 6 * 16) / 5.f));
- }];
-
- [_coachLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.mas_equalTo(_coachIconImageView);
- make.left.mas_equalTo(_coachIconImageView.mas_right).mas_offset(8);
- make.size.mas_equalTo(CGSizeMake((self.bounds.size.width - 16 * 2 - 8 - _coachIconImageView.frame.size.width), (self.bounds.size.height - 6 * 16) / 4.f));
- }];
-
- [_objectIconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(_coachIconImageView.mas_bottom).mas_offset(16);
- make.left.mas_equalTo(_coachIconImageView);
- make.size.mas_equalTo(CGSizeMake((self.bounds.size.height - 6 * 16) / 5.f , (self.bounds.size.height - 6 * 16) / 5.f));
- }];
-
- [_objectLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.mas_equalTo(_objectIconImageView);
- make.left.mas_equalTo(_coachIconImageView.mas_right).mas_offset(8);
- make.size.mas_equalTo(CGSizeMake([@"科目一: " widthForFont:[UIFont systemFontOfSize:15]], (self.bounds.size.height - 6 * 16) / 4.f));
- }];
-
- [_objectScoreLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.mas_equalTo(_objectIconImageView);
- make.left.mas_equalTo(_objectLabel.mas_right).mas_offset(0);
- make.size.mas_equalTo(CGSizeMake((self.bounds.size.width - 16 * 2 - 8 - _coachIconImageView.frame.size.width - [@"科目一: " widthForFont:[UIFont systemFontOfSize:15]]), (self.bounds.size.height - 6 * 16) / 4.f));
- }];
-
- [_dateIconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(_objectIconImageView.mas_bottom).mas_offset(16);
- make.left.mas_equalTo(_objectIconImageView);
- make.size.mas_equalTo(CGSizeMake((self.bounds.size.height - 6 * 16) / 5.f , (self.bounds.size.height - 6 * 16) / 5.f));
- }];
-
- [_dateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.mas_equalTo(_dateIconImageView);
- make.left.mas_equalTo(_dateIconImageView.mas_right).mas_offset(8);
- make.size.mas_equalTo(CGSizeMake((self.bounds.size.width - 16 * 2 - 8 - _coachIconImageView.frame.size.width), (self.bounds.size.height - 6 * 16) / 4.f));
- }];
- }
- #pragma mark - HDUpdateUIProtocol
- - (void)updateCellUI:(__kindof HDCellModel *)model {
- PreExamMarkModel *preExamMarkModel = model.orgData;
- _studentNameLabel.text = [NSString stringWithFormat:@"学员:%@", preExamMarkModel.studentName];
- _passStatusLabel.text = [NSString stringWithFormat:@"%@", preExamMarkModel.passStatus];
- _passStatusLabel.textColor = [preExamMarkModel.passStatus isEqualToString:@"未通过"]? RQRedColor : RQGreenColor;
- _coachLabel.text = [NSString stringWithFormat:@"教练:%@", preExamMarkModel.coachName];
- _objectLabel.text = [NSString stringWithFormat:@"%@:", preExamMarkModel.object];
- _objectScoreLabel.text = [NSString stringWithFormat:@"%@", preExamMarkModel.objectScore];
- _dateLabel.text = [NSString stringWithFormat:@"预考时间:%@", preExamMarkModel.date];
- }
- #pragma mark - Lazy Load
- - (UILabel *)studentNameLabel {
- if (!_studentNameLabel) {
- _studentNameLabel = [[UILabel alloc] init];
- _studentNameLabel.text = @"学员:张小凡";
- _studentNameLabel.textAlignment = NSTextAlignmentLeft;
- _studentNameLabel.textColor = RQContentTextColor;
- _studentNameLabel.numberOfLines = 0;
- _studentNameLabel.font = [UIFont systemFontOfSize:16];
- }
- return _studentNameLabel;
- }
- - (YYLabel *)passStatusLabel {
- if (!_passStatusLabel) {
- _passStatusLabel = [[YYLabel alloc] init];
- _passStatusLabel.text = @"通过";
- _passStatusLabel.textAlignment = NSTextAlignmentRight;
- _passStatusLabel.textColor = RQTitleTextColor;
- _passStatusLabel.numberOfLines = 0;
- _passStatusLabel.font = [UIFont systemFontOfSize:16];
- }
- return _passStatusLabel;
- }
- - (UIImageView *)centerLineView {
- if (!_centerLineView) {
- _centerLineView = [[UIImageView alloc] init];
- _centerLineView.backgroundColor = RQBackGroundColor;
- }
- return _centerLineView;
- }
- - (UIImageView *)coachIconImageView {
- if (!_coachIconImageView) {
- _coachIconImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"coachIcon"]];
- }
- return _coachIconImageView;
- }
- - (UILabel *)coachLabel {
- if (!_coachLabel) {
- _coachLabel = [[UILabel alloc] init];
- _coachLabel.text = @"教练:张小丽";
- _coachLabel.textAlignment = NSTextAlignmentLeft;
- _coachLabel.textColor = RQTitleTextColor;
- _coachLabel.numberOfLines = 0;
- _coachLabel.font = [UIFont systemFontOfSize:15];
- }
- return _coachLabel;
- }
- - (UIImageView *)objectIconImageView {
- if (!_objectIconImageView) {
- _objectIconImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"objectIcon"]];
- }
- return _objectIconImageView;
- }
- - (UILabel *)objectLabel {
- if (!_objectLabel) {
- _objectLabel = [[UILabel alloc] init];
- _objectLabel.text = @"科目一:";
- _objectLabel.textAlignment = NSTextAlignmentLeft;
- _objectLabel.textColor = RQTitleTextColor;
- _objectLabel.numberOfLines = 0;
- _objectLabel.font = [UIFont systemFontOfSize:15];
- }
- return _objectLabel;
- }
- - (UILabel *)objectScoreLabel {
- if (!_objectScoreLabel) {
- _objectScoreLabel = [[UILabel alloc] init];
- _objectScoreLabel.text = @"90";
- _objectScoreLabel.textAlignment = NSTextAlignmentLeft;
- _objectScoreLabel.textColor = RQTitleTextColor;
- _objectScoreLabel.numberOfLines = 0;
- _objectScoreLabel.font = [UIFont systemFontOfSize:15];
- }
- return _objectScoreLabel;
- }
- - (UIImageView *)dateIconImageView {
- if (!_dateIconImageView) {
- _dateIconImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"dateIcon"]];
- }
- return _dateIconImageView;
- }
- - (UILabel *)dateLabel {
- if (!_dateLabel) {
- _dateLabel = [[UILabel alloc] init];
- _dateLabel.text = @"预考时间:2019-09-09";
- _dateLabel.textAlignment = NSTextAlignmentLeft;
- _dateLabel.textColor = RQTitleTextColor;
- _dateLabel.numberOfLines = 0;
- _dateLabel.font = [UIFont systemFontOfSize:15];
- }
- return _dateLabel;
- }
- @end
|