123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- //
- // SignUpSituationCell.m
- // LN_School
- //
- // Created by 张嵘 on 2019/7/31.
- // Copyright © 2019 Danson. All rights reserved.
- //
- #import "SignUpSituationCell.h"
- #import "SignUpSituationModel.h"
- @interface SignUpSituationCell ()
- @property (nonatomic, readwrite, strong) UIImageView *headImageView;
- @property (nonatomic, readwrite, strong) UILabel *nameLabel;
- @property (nonatomic, readwrite, strong) UILabel *sexLabel;
- @property (nonatomic, readwrite, strong) UILabel *schoolLabel;
- @property (nonatomic, readwrite, strong) UIImageView *arrowImageView;
- @property (nonatomic, readwrite, strong) UIImageView *bottomLineView;
- @end
- @implementation SignUpSituationCell
- #pragma mark - Life Cycle
- - (instancetype)initWithFrame:(CGRect)frame {
- self = [super initWithFrame:frame];
- if (self) {
- self.contentView.backgroundColor = UIColor.whiteColor;
- [self.contentView addSubview:self.headImageView];
- [self.contentView addSubview:self.nameLabel];
- [self.contentView addSubview:self.sexLabel];
- [self.contentView addSubview:self.schoolLabel];
- [self.contentView addSubview:self.arrowImageView];
- [self.contentView addSubview:self.bottomLineView];
- }
- __weak typeof(self) weakS = self;
- [self addTapActionWithBlock:^(UIGestureRecognizer *gestureRecoginzer) {
- [weakS clickSelf];
- }];
- return self;
- }
- - (void)layoutSubviews {
- [super layoutSubviews];
- CGFloat width = self.bounds.size.width - 16 - 16 - 16;
-
- [_headImageView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.mas_equalTo(self.contentView);
- make.left.mas_equalTo(self.contentView).mas_offset(16);
- make.size.mas_equalTo(CGSizeMake(width * 0.15, width * 0.15));
- }];
-
- [_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(self.contentView).mas_offset(8);
- make.left.mas_equalTo(_headImageView.mas_right).mas_offset(16);
- make.size.mas_equalTo(CGSizeMake(width * 0.425, self.bounds.size.height * 0.4));
- }];
-
- [_sexLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(_nameLabel);
- make.bottom.mas_equalTo(self.contentView).mas_offset(-8);
- make.size.mas_equalTo(_nameLabel);
- }];
-
- [_arrowImageView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.mas_equalTo(self.contentView);
- make.right.mas_equalTo(self.contentView).mas_offset(-16);
- make.size.mas_equalTo(CGSizeMake(width * 0.025, (width * 0.025) * (39.0 / 21.0)));
- }];
-
- [_schoolLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.mas_equalTo(self.contentView);
- make.right.mas_equalTo(_arrowImageView.mas_left);
- make.size.mas_equalTo(CGSizeMake(width * 0.4, self.bounds.size.height * 0.4));
- }];
-
- [_bottomLineView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_offset(16);
- make.right.mas_offset(-16);
- make.bottom.mas_offset(0);
- make.height.mas_equalTo(1);
- }];
- }
- #pragma mark - HDUpdateUIProtocol
- - (void)updateCellUI:(__kindof HDCellModel *)model {
- SignUpSituationModel *signUpSituationModel = model.orgData;
- self.headImageView.image = [UIImage imageNamed:signUpSituationModel.imageName];
- self.nameLabel.text = [NSString stringWithFormat:@"姓名:%@",signUpSituationModel.name];
- self.sexLabel.text = [NSString stringWithFormat:@"性别:%@",signUpSituationModel.sex];
- self.schoolLabel.text = [NSString stringWithFormat:@"驾校:%@",signUpSituationModel.school];
- }
- #pragma mark - Private Functions
- - (void)clickSelf {
- self.callback(self.hdModel);
- }
- #pragma mark - Lazy Load
- - (UIImageView *)headImageView {
- if (!_headImageView) {
- _headImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"HeaderPlacehold"]];
- }
- return _headImageView;
- }
- - (UILabel *)nameLabel {
- if (!_nameLabel) {
- _nameLabel = [[UILabel alloc] init];
- _nameLabel.textAlignment = NSTextAlignmentLeft;
- _nameLabel.textColor = RQTitleTextColor;
- _nameLabel.numberOfLines = 0;
- _nameLabel.font = [UIFont systemFontOfSize:15];
- }
- return _nameLabel;
- }
- - (UILabel *)sexLabel {
- if (!_sexLabel) {
- _sexLabel = [[UILabel alloc] init];
- _sexLabel.textAlignment = NSTextAlignmentLeft;
- _sexLabel.textColor = RQTitleTextColor;
- _sexLabel.numberOfLines = 0;
- _sexLabel.font = [UIFont systemFontOfSize:15];
- }
- return _sexLabel;
- }
- - (UILabel *)schoolLabel {
- if (!_schoolLabel) {
- _schoolLabel = [[UILabel alloc] init];
- _schoolLabel.textAlignment = NSTextAlignmentLeft;
- _schoolLabel.textColor = RQTitleTextColor;
- _schoolLabel.numberOfLines = 0;
- _schoolLabel.font = [UIFont systemFontOfSize:15];
- }
- return _schoolLabel;
- }
- - (UIImageView *)arrowImageView {
- if (!_arrowImageView) {
- _arrowImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Arrow"]];
- }
- return _arrowImageView;
- }
- - (UIImageView *)bottomLineView {
- if (!_bottomLineView) {
- _bottomLineView = [[UIImageView alloc] init];
- _bottomLineView.backgroundColor = RQBackGroundColor;
- }
- return _bottomLineView;
- }
- @end
|