SignUpSituationHeaderView.m 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. //
  2. // SignUpSituationHeaderView.m
  3. // LN_School
  4. //
  5. // Created by 张嵘 on 2019/7/31.
  6. // Copyright © 2019 Danson. All rights reserved.
  7. //
  8. #import "SignUpSituationHeaderView.h"
  9. #import "SignUpSituationHeaderModel.h"
  10. @interface SignUpSituationHeaderView ()
  11. @property (nonatomic, readwrite, strong) UIButton *signUpNumBtn;
  12. @end
  13. @implementation SignUpSituationHeaderView
  14. #pragma mark - Life Cycle
  15. - (instancetype)initWithFrame:(CGRect)frame {
  16. self = [super initWithFrame:frame];
  17. if (self) {
  18. self.backgroundColor = UIColor.whiteColor;
  19. [self addSubview:self.signUpNumBtn];
  20. }
  21. return self;
  22. }
  23. - (void)layoutSubviews {
  24. [super layoutSubviews];
  25. [_signUpNumBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  26. make.left.mas_offset(24);
  27. make.centerY.mas_equalTo(self);
  28. make.size.mas_equalTo(CGSizeMake((kScreenWidth - 72) / 2.f, self.bounds.size.height * 0.6));
  29. _signUpNumBtn.layer.cornerRadius = self.bounds.size.height * 0.3;
  30. }];
  31. }
  32. #pragma mark - Private Functions
  33. - (void)updateSecVUI:(__kindof HDSectionModel *)model {
  34. SignUpSituationHeaderModel *headerModel = model.headerObj;
  35. _signUpNumBtn.hidden = !headerModel.leftLabelText;
  36. [_signUpNumBtn setTitle:headerModel.leftLabelText? : @"" forState:UIControlStateNormal];
  37. }
  38. #pragma mark - LazyLoad
  39. - (UIButton *)signUpNumBtn {
  40. if (!_signUpNumBtn) {
  41. _signUpNumBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  42. [_signUpNumBtn setTitle:@"" forState:UIControlStateNormal];
  43. _signUpNumBtn.titleLabel.font = [UIFont systemFontOfSize:13];
  44. _signUpNumBtn.titleLabel.textAlignment = NSTextAlignmentLeft;
  45. _signUpNumBtn.titleLabel.textColor = UIColor.whiteColor;
  46. _signUpNumBtn.backgroundColor = RQPinkBlueColor;
  47. _signUpNumBtn.clipsToBounds = YES;
  48. }
  49. return _signUpNumBtn;
  50. }
  51. @end