HomePageSignUpSituationCell.m 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. //
  2. // HomePageSignUpSituationCell.m
  3. // LN_School
  4. //
  5. // Created by 张嵘 on 2019/7/10.
  6. // Copyright © 2019 Danson. All rights reserved.
  7. //
  8. #import "HomePageSignUpSituationCell.h"
  9. #import "UIView+gesture.h"
  10. #import "HomePageSignUpSituationModel.h"
  11. @interface HomePageSignUpSituationCell ()
  12. @property (nonatomic, readwrite, strong) UIImageView *headImageView;
  13. @property (nonatomic, readwrite, strong) UILabel *nameLabel;
  14. @property (nonatomic, readwrite, strong) UILabel *sexLabel;
  15. @property (nonatomic, readwrite, strong) UILabel *schoolLabel;
  16. @property (nonatomic, readwrite, strong) UIImageView *arrowImageView;
  17. @property (nonatomic, readwrite, strong) UIImageView *bottomLineView;
  18. @end
  19. @implementation HomePageSignUpSituationCell
  20. #pragma mark - Life Cycle
  21. - (instancetype)initWithFrame:(CGRect)frame {
  22. self = [super initWithFrame:frame];
  23. if (self) {
  24. self.contentView.backgroundColor = UIColor.whiteColor;
  25. [self.contentView addSubview:self.headImageView];
  26. [self.contentView addSubview:self.nameLabel];
  27. [self.contentView addSubview:self.sexLabel];
  28. [self.contentView addSubview:self.schoolLabel];
  29. [self.contentView addSubview:self.arrowImageView];
  30. [self.contentView addSubview:self.bottomLineView];
  31. }
  32. __weak typeof(self) weakS = self;
  33. [self addTapActionWithBlock:^(UIGestureRecognizer *gestureRecoginzer) {
  34. [weakS clickSelf];
  35. }];
  36. return self;
  37. }
  38. - (void)layoutSubviews {
  39. [super layoutSubviews];
  40. CGFloat width = self.bounds.size.width - 16 - 16 - 16;
  41. [_headImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  42. make.centerY.mas_equalTo(self.contentView);
  43. make.left.mas_equalTo(self.contentView).mas_offset(16);
  44. make.size.mas_equalTo(CGSizeMake(width * 0.15, width * 0.15));
  45. }];
  46. [_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  47. make.top.mas_equalTo(self.contentView).mas_offset(8);
  48. make.left.mas_equalTo(_headImageView.mas_right).mas_offset(16);
  49. make.size.mas_equalTo(CGSizeMake(width * 0.425, self.bounds.size.height * 0.4));
  50. }];
  51. [_sexLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  52. make.left.mas_equalTo(_nameLabel);
  53. make.bottom.mas_equalTo(self.contentView).mas_offset(-8);
  54. make.size.mas_equalTo(_nameLabel);
  55. }];
  56. [_arrowImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  57. make.centerY.mas_equalTo(self.contentView);
  58. make.right.mas_equalTo(self.contentView).mas_offset(-16);
  59. make.size.mas_equalTo(CGSizeMake(width * 0.025, (width * 0.025) * (39.0 / 21.0)));
  60. }];
  61. [_schoolLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  62. make.centerY.mas_equalTo(self.contentView);
  63. make.right.mas_equalTo(_arrowImageView.mas_left);
  64. make.size.mas_equalTo(CGSizeMake(width * 0.4, self.bounds.size.height * 0.4));
  65. }];
  66. [_bottomLineView mas_makeConstraints:^(MASConstraintMaker *make) {
  67. make.left.mas_offset(16);
  68. make.right.mas_offset(-16);
  69. make.bottom.mas_offset(0);
  70. make.height.mas_equalTo(1);
  71. }];
  72. }
  73. #pragma mark - HDUpdateUIProtocol
  74. - (void)updateCellUI:(__kindof HDCellModel *)model {
  75. HomePageSignUpSituationModel *homePageSignUpSituationModel = model.orgData;
  76. self.headImageView.image = [UIImage imageNamed:homePageSignUpSituationModel.imageName];
  77. self.nameLabel.text = [NSString stringWithFormat:@"姓名:%@",homePageSignUpSituationModel.name];
  78. self.sexLabel.text = [NSString stringWithFormat:@"性别:%@",homePageSignUpSituationModel.sex];
  79. self.schoolLabel.text = [NSString stringWithFormat:@"驾校:%@",homePageSignUpSituationModel.school];
  80. }
  81. #pragma mark - Private Functions
  82. - (void)clickSelf {
  83. self.callback(self.hdModel);
  84. }
  85. #pragma mark - Lazy Load
  86. - (UIImageView *)headImageView {
  87. if (!_headImageView) {
  88. _headImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"HeaderPlacehold"]];
  89. }
  90. return _headImageView;
  91. }
  92. - (UILabel *)nameLabel {
  93. if (!_nameLabel) {
  94. _nameLabel = [[UILabel alloc] init];
  95. _nameLabel.textAlignment = NSTextAlignmentLeft;
  96. _nameLabel.textColor = RQTitleTextColor;
  97. _nameLabel.numberOfLines = 0;
  98. _nameLabel.font = [UIFont systemFontOfSize:15];
  99. }
  100. return _nameLabel;
  101. }
  102. - (UILabel *)sexLabel {
  103. if (!_sexLabel) {
  104. _sexLabel = [[UILabel alloc] init];
  105. _sexLabel.textAlignment = NSTextAlignmentLeft;
  106. _sexLabel.textColor = RQTitleTextColor;
  107. _sexLabel.numberOfLines = 0;
  108. _sexLabel.font = [UIFont systemFontOfSize:15];
  109. }
  110. return _sexLabel;
  111. }
  112. - (UILabel *)schoolLabel {
  113. if (!_schoolLabel) {
  114. _schoolLabel = [[UILabel alloc] init];
  115. _schoolLabel.textAlignment = NSTextAlignmentLeft;
  116. _schoolLabel.textColor = RQTitleTextColor;
  117. _schoolLabel.numberOfLines = 0;
  118. _schoolLabel.font = [UIFont systemFontOfSize:15];
  119. }
  120. return _schoolLabel;
  121. }
  122. - (UIImageView *)arrowImageView {
  123. if (!_arrowImageView) {
  124. _arrowImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Arrow"]];
  125. }
  126. return _arrowImageView;
  127. }
  128. - (UIImageView *)bottomLineView {
  129. if (!_bottomLineView) {
  130. _bottomLineView = [[UIImageView alloc] init];
  131. _bottomLineView.backgroundColor = RQBackGroundColor;
  132. }
  133. return _bottomLineView;
  134. }
  135. @end