123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- //
- // AppointmentManageCell.m
- // LN_School
- //
- // Created by 张嵘 on 2019/7/31.
- // Copyright © 2019 Danson. All rights reserved.
- //
- #import "AppointmentManageCell.h"
- #import "AppointmentManageModel.h"
- @interface AppointmentManageCell ()
- @property (nonatomic, readwrite, strong) UIImageView *centerLineView;
- @property (nonatomic, readwrite, strong) UILabel *nameLabel;
- @property (nonatomic, readwrite, strong) YYLabel *statusLabel;
- @property (nonatomic, readwrite, strong) UILabel *timeLabel;
- @property (nonatomic, readwrite, strong) UILabel *objectLabel;
- @end
- @implementation AppointmentManageCell
- #pragma mark - Life Cycle
- - (instancetype)initWithFrame:(CGRect)frame {
- self = [super initWithFrame:frame];
- if (self) {
- self.contentView.backgroundColor = UIColor.whiteColor;
- [self.contentView addSubview:self.nameLabel];
- [self.contentView addSubview:self.statusLabel];
- [self.contentView addSubview:self.timeLabel];
- [self.contentView addSubview:self.objectLabel];
- }
- return self;
- }
- - (void)layoutSubviews {
- [super layoutSubviews];
-
- [_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.left.mas_offset(16);
- make.size.mas_equalTo(CGSizeMake((self.bounds.size.width - 16 * 3) * (1.f / 2.f), (self.bounds.size.height - 3 * 16) / 2.f));
- }];
-
- [_statusLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(_nameLabel);
- make.right.mas_offset(-16);
- make.size.mas_equalTo(_nameLabel);
- }];
-
- [_timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(_nameLabel.mas_bottom).mas_offset(16);
- make.left.mas_equalTo(_nameLabel);
- make.size.mas_equalTo(_nameLabel);
- }];
-
- [_objectLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(_statusLabel.mas_bottom).mas_offset(16);
- make.right.mas_equalTo(-16);
- make.size.mas_equalTo(_nameLabel);
- }];
- }
- #pragma mark - HDUpdateUIProtocol
- - (void)updateCellUI:(__kindof HDCellModel *)model {
- AppointmentManageModel *appointmentManageModel = model.orgData;
- self.nameLabel.text = [NSString stringWithFormat:@"学员:%@", appointmentManageModel.name];
- self.timeLabel.text = [NSString stringWithFormat:@"考试时间:%@", appointmentManageModel.date];
- self.objectLabel.text = [NSString stringWithFormat:@"科目:%@", appointmentManageModel.object];
- _statusLabel.text = [NSString stringWithFormat:@"状态:%@",appointmentManageModel.status];
- NSMutableAttributedString *remarkLabelAttStr = [[NSMutableAttributedString alloc] initWithString:_statusLabel.text];
- remarkLabelAttStr.yy_color = RQGreenColor;
- [remarkLabelAttStr yy_setColor:RQTitleTextColor range:[_statusLabel.text rangeOfString:@"状态:"]];
- remarkLabelAttStr.yy_font = [UIFont systemFontOfSize:16];
- remarkLabelAttStr.yy_alignment = NSTextAlignmentRight;
- _statusLabel.attributedText = remarkLabelAttStr;
- }
- #pragma mark - Lazy Load
- - (UILabel *)nameLabel {
- if (!_nameLabel) {
- _nameLabel = [[UILabel alloc] init];
- _nameLabel.text = @"学员:";
- _nameLabel.textAlignment = NSTextAlignmentLeft;
- _nameLabel.textColor = RQTitleTextColor;
- _nameLabel.numberOfLines = 0;
- _nameLabel.font = [UIFont systemFontOfSize:16];
- }
- return _nameLabel;
- }
- - (YYLabel *)statusLabel {
- if (!_statusLabel) {
- _statusLabel = [[YYLabel alloc] init];
- _statusLabel.text = @"状态:";
- _statusLabel.textAlignment = NSTextAlignmentRight;
- _statusLabel.textColor = RQTitleTextColor;
- _statusLabel.numberOfLines = 0;
- _statusLabel.font = [UIFont systemFontOfSize:16];
- }
- return _statusLabel;
- }
- - (UILabel *)timeLabel {
- if (!_timeLabel) {
- _timeLabel = [[UILabel alloc] init];
- _timeLabel.text = @"考试时间:2019-09-09";
- _timeLabel.textAlignment = NSTextAlignmentLeft;
- _timeLabel.textColor = RQTitleTextColor;
- _timeLabel.numberOfLines = 0;
- _timeLabel.font = [UIFont systemFontOfSize:16];
- }
- return _timeLabel;
- }
- - (UILabel *)objectLabel {
- if (!_objectLabel) {
- _objectLabel = [[UILabel alloc] init];
- _objectLabel.text = @"科目:";
- _objectLabel.textAlignment = NSTextAlignmentRight;
- _objectLabel.textColor = RQTitleTextColor;
- _objectLabel.numberOfLines = 0;
- _objectLabel.font = [UIFont systemFontOfSize:16];
- }
- return _objectLabel;
- }
- @end
|