123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251 |
- //
- // AppointDriverCell.m
- // LN_School
- //
- // Created by 张嵘 on 2019/8/1.
- // Copyright © 2019 Danson. All rights reserved.
- //
- #import "AppointDriverCell.h"
- #import "AppointDriverModel.h"
- @interface AppointDriverCell ()
- @property (nonatomic, readwrite, strong) UILabel *codeLabel;
- @property (nonatomic, readwrite, strong) UIButton *studyStatusBtn;
- @property (nonatomic, readwrite, strong) UIImageView *centerLineView;
- @property (nonatomic, readwrite, strong) UIImageView *coachIconImageView;
- @property (nonatomic, readwrite, strong) UILabel *studentNameLabel;
- @property (nonatomic, readwrite, strong) UIImageView *objectIconImageView;
- @property (nonatomic, readwrite, strong) UILabel *objectLabel;
- @property (nonatomic, readwrite, strong) UILabel *objectStatusLabel;
- @property (nonatomic, readwrite, strong) UIImageView *dateIconImageView;
- @property (nonatomic, readwrite, strong) UILabel *dateLabel;
- @property (nonatomic, readwrite, strong) UIButton *studyBtn;
- @end
- @implementation AppointDriverCell
- #pragma mark - Life Cycle
- - (instancetype)initWithFrame:(CGRect)frame {
- self = [super initWithFrame:frame];
- if (self) {
- self.contentView.backgroundColor = UIColor.whiteColor;
- [self.contentView addSubview:self.codeLabel];
- [self.contentView addSubview:self.studyStatusBtn];
- [self.contentView addSubview:self.centerLineView];
- [self.contentView addSubview:self.coachIconImageView];
- [self.contentView addSubview:self.studentNameLabel];
- [self.contentView addSubview:self.objectIconImageView];
- [self.contentView addSubview:self.objectLabel];
- [self.contentView addSubview:self.objectStatusLabel];
- [self.contentView addSubview:self.dateIconImageView];
- [self.contentView addSubview:self.dateLabel];
- [self.contentView addSubview:self.studyBtn];
- }
- return self;
- }
- - (void)layoutSubviews {
- [super layoutSubviews];
-
- [_studyStatusBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.left.mas_offset(16);
- make.size.mas_equalTo(CGSizeMake([@" 未学习 " widthForFont:[UIFont systemFontOfSize:16]], (self.bounds.size.height - 5 * 16) / 4.f));
- }];
-
- [_codeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(_studyStatusBtn.mas_right).mas_equalTo(8);
- make.centerY.mas_equalTo(_studyStatusBtn);
- make.size.mas_equalTo(CGSizeMake(self.bounds.size.width - 32 - 8 - [@" 未学习 " widthForFont:[UIFont systemFontOfSize:16]], (self.bounds.size.height - 6 * 16) / 4.f));
- }];
-
- [_centerLineView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(_codeLabel.mas_bottom).mas_offset(16);
- make.left.mas_equalTo(_studyStatusBtn);
- 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(_studyStatusBtn);
- make.size.mas_equalTo(CGSizeMake((self.bounds.size.height - 6 * 16) / 5.f , (self.bounds.size.height - 6 * 16) / 5.f));
- }];
-
- [_studentNameLabel 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]] + 1, (self.bounds.size.height - 6 * 16) / 4.f));
- }];
-
- [_objectStatusLabel 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));
- }];
-
- [_studyBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.mas_equalTo(_objectIconImageView);
- make.right.mas_offset(-16);
- make.size.mas_equalTo(CGSizeMake([@" 开始上课 " widthForFont:[UIFont systemFontOfSize:16]], (self.bounds.size.height - 7 * 16) / 2.f));
- _studyBtn.layer.cornerRadius = (self.bounds.size.height - 7 * 16) / 4.f;
- _studyBtn.layer.masksToBounds = YES;
- }];
- }
- #pragma mark - HDUpdateUIProtocol
- - (void)updateCellUI:(__kindof HDCellModel *)model {
- AppointDriverModel *appointDriverModel = model.orgData;
- _codeLabel.text = [NSString stringWithFormat:@"%@", appointDriverModel.code];
- [_studyStatusBtn setTitle:[NSString stringWithFormat:@"%@", appointDriverModel.passStatus] forState:UIControlStateNormal];
- _studyStatusBtn.backgroundColor = [appointDriverModel.passStatus isEqualToString:@"未学习"]? RQPinkGreenColor : RQOrangeColor;
- _studentNameLabel.text = [NSString stringWithFormat:@"学员:%@", appointDriverModel.studentName];
- _objectStatusLabel.text = [NSString stringWithFormat:@"%@", appointDriverModel.objectStatus];
- _dateLabel.text = [NSString stringWithFormat:@"时间:%@", appointDriverModel.date];
- _studyBtn.hidden = [appointDriverModel.passStatus isEqualToString:@"已学习"];
- }
- #pragma mark - Lazy Load
- - (UILabel *)codeLabel {
- if (!_codeLabel) {
- _codeLabel = [[UILabel alloc] init];
- _codeLabel.text = @"";
- _codeLabel.textAlignment = NSTextAlignmentLeft;
- _codeLabel.textColor = RQContentTextColor;
- _codeLabel.numberOfLines = 0;
- _codeLabel.font = [UIFont systemFontOfSize:15];
- }
- return _codeLabel;
- }
- - (UIButton *)studyStatusBtn {
- if (!_studyStatusBtn) {
- _studyStatusBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- [_studyStatusBtn setTitle:@"未学习" forState:UIControlStateNormal];
- _studyStatusBtn.titleLabel.textAlignment = NSTextAlignmentCenter;
- _studyStatusBtn.titleLabel.textColor = UIColor.whiteColor;
- _studyStatusBtn.backgroundColor = RQPinkGreenColor;
- _studyStatusBtn.titleLabel.numberOfLines = 0;
- _studyStatusBtn.titleLabel.font = [UIFont systemFontOfSize:16];
- _studyStatusBtn.layer.cornerRadius = 3;
- _studyStatusBtn.layer.masksToBounds = YES;
- }
- return _studyStatusBtn;
- }
- - (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 *)studentNameLabel {
- if (!_studentNameLabel) {
- _studentNameLabel = [[UILabel alloc] init];
- _studentNameLabel.text = @"学员:张小丽";
- _studentNameLabel.textAlignment = NSTextAlignmentLeft;
- _studentNameLabel.textColor = RQTitleTextColor;
- _studentNameLabel.numberOfLines = 0;
- _studentNameLabel.font = [UIFont systemFontOfSize:15];
- }
- return _studentNameLabel;
- }
- - (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 *)objectStatusLabel {
- if (!_objectStatusLabel) {
- _objectStatusLabel = [[UILabel alloc] init];
- _objectStatusLabel.text = @"90";
- _objectStatusLabel.textAlignment = NSTextAlignmentLeft;
- _objectStatusLabel.textColor = RQTitleTextColor;
- _objectStatusLabel.numberOfLines = 0;
- _objectStatusLabel.font = [UIFont systemFontOfSize:15];
- }
- return _objectStatusLabel;
- }
- - (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;
- }
- - (UIButton *)studyBtn {
- if (!_studyBtn) {
- _studyBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- [_studyBtn setTitle:@"开始上课" forState:UIControlStateNormal];
- _studyBtn.titleLabel.textAlignment = NSTextAlignmentCenter;
- _studyBtn.titleLabel.textColor = UIColor.whiteColor;
- _studyBtn.backgroundColor = RQSubColor;
- _studyBtn.titleLabel.numberOfLines = 0;
- _studyBtn.titleLabel.font = [UIFont systemFontOfSize:16];
- }
- return _studyBtn;
- }
- @end
|