BHomeInvitationCompanyView.m 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. //
  2. // BHomeInvitationCompanyView.m
  3. // HappyJob
  4. //
  5. // Created by 张晓光 on 2019/7/3.
  6. // Copyright © 2019 Bob. All rights reserved.
  7. //
  8. #import "BHomeInvitationCompanyView.h"
  9. @interface BHomeInvitationCompanyView ()
  10. @property (nonatomic, strong) UIImageView *iconImageV;
  11. @property (nonatomic, strong) UIButton *sendBtn;
  12. @property (nonatomic, strong) UILabel *detailLabel;
  13. @end
  14. @implementation BHomeInvitationCompanyView
  15. - (instancetype)initWithFrame:(CGRect)frame {
  16. if (self = [super initWithFrame:frame])
  17. {
  18. [self initViews];
  19. [self autoLayOutViews];
  20. }
  21. return self;
  22. }
  23. - (void)initViews {
  24. [self addSubview:self.iconImageV];
  25. [self addSubview:self.companyNameLabel];
  26. [self addSubview:self.sendBtn];
  27. [self addSubview:self.nameLabel];
  28. [self addSubview:self.detailLabel];
  29. }
  30. - (void)autoLayOutViews {
  31. __weak typeof(self) weakSelf = self;
  32. [_iconImageV mas_makeConstraints:^(MASConstraintMaker *make) {
  33. make.leading.equalTo(weakSelf.mas_leading).offset(45);
  34. make.top.equalTo(weakSelf.mas_top).offset(30);
  35. make.size.mas_offset(CGSizeMake(21, 21));
  36. }];
  37. [_companyNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  38. make.leading.equalTo(weakSelf.iconImageV.mas_trailing).offset(10);
  39. make.centerY.equalTo(weakSelf.iconImageV);
  40. }];
  41. [_sendBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  42. make.trailing.equalTo(weakSelf.mas_trailing).offset(-45);
  43. make.centerY.equalTo(weakSelf.iconImageV);
  44. make.size.mas_offset(CGSizeMake(50, 20));
  45. }];
  46. _sendBtn.layer.cornerRadius = 20/2;
  47. [_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  48. make.leading.equalTo(weakSelf.mas_leading).offset(45);
  49. make.top.equalTo(weakSelf.iconImageV.mas_bottom).offset(55);
  50. }];
  51. [_detailLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  52. make.leading.equalTo(weakSelf.mas_leading).offset(45);
  53. make.top.equalTo(weakSelf.nameLabel.mas_bottom).offset(23);
  54. make.trailing.equalTo(weakSelf.mas_trailing).offset(-45);
  55. make.bottom.equalTo(weakSelf.mas_bottom).offset(-10);
  56. }];
  57. self.companyNameLabel.text = @"公司";
  58. self.nameLabel.text = @"先生:";
  59. self.detailLabel.text = @"您好,\n我们已经查阅过您的简历并对您很感兴趣,希望您能来我司进行面试,具体内容与时间安排如下:";
  60. }
  61. - (void)sendButtonClick {
  62. self.sendInvitationBlock(self.sendBtn);
  63. }
  64. #pragma mark - setter&getter
  65. - (UIImageView *)iconImageV {
  66. if (_iconImageV == nil)
  67. {
  68. _iconImageV = [[UIImageView alloc]init];
  69. _iconImageV.image = [UIImage imageNamed:@"b_invitation_company"];
  70. }
  71. return _iconImageV;
  72. }
  73. - (UILabel *)companyNameLabel {
  74. if (_companyNameLabel == nil)
  75. {
  76. _companyNameLabel = [[UILabel alloc]init];
  77. _companyNameLabel.font = [UIFont systemFontOfSize:12];
  78. _companyNameLabel.textColor = COLOR_BACK3;
  79. }
  80. return _companyNameLabel;
  81. }
  82. - (UIButton *)sendBtn {
  83. if (_sendBtn == nil)
  84. {
  85. _sendBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  86. [_sendBtn setTitle:@"发送" forState:UIControlStateNormal];
  87. _sendBtn.layer.borderWidth = 1;
  88. _sendBtn.layer.borderColor = COLOR_BLUE_4183E1.CGColor;
  89. [_sendBtn setTitleColor:COLOR_BLUE_4183E1 forState:UIControlStateNormal];
  90. _sendBtn.titleLabel.font = [UIFont systemFontOfSize:12];
  91. [_sendBtn addTarget:self action:@selector(sendButtonClick) forControlEvents:UIControlEventTouchUpInside];
  92. }
  93. return _sendBtn;
  94. }
  95. - (UILabel *)nameLabel {
  96. if (_nameLabel == nil)
  97. {
  98. _nameLabel = [[UILabel alloc]init];
  99. _nameLabel.font = [UIFont systemFontOfSize:18];
  100. _nameLabel.textColor = COLOR_BACK3;
  101. }
  102. return _nameLabel;
  103. }
  104. - (UILabel *)detailLabel {
  105. if (_detailLabel == nil)
  106. {
  107. _detailLabel = [[UILabel alloc]init];
  108. _detailLabel.font = [UIFont systemFontOfSize:12];
  109. _detailLabel.textColor = COLOR_BACK3;
  110. _detailLabel.numberOfLines = 0;
  111. }
  112. return _detailLabel;
  113. }
  114. /*
  115. // Only override drawRect: if you perform custom drawing.
  116. // An empty implementation adversely affects performance during animation.
  117. - (void)drawRect:(CGRect)rect {
  118. // Drawing code
  119. }
  120. */
  121. @end