| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206 |
- //
- // HJFullTimeDetailHeaderView.m
- // HappyJob
- //
- // Created by 张晓光 on 2019/8/16.
- // Copyright © 2019 Bob. All rights reserved.
- //
- #import "HJFullTimeDetailHeaderView.h"
- #import "HJPositionDetailDataBox.h"
- @interface HJFullTimeDetailHeaderView ()
- @property (nonatomic, strong) UIView *topView;//顶部的view
- @property (nonatomic, strong) UIView *titleView;//标题
- @property (nonatomic, strong) UIView *salaryView;//薪资
- @property (nonatomic, strong) UIView *lineView1;
- @property (nonatomic, strong) UILabel *feeLabel;//反费
- @property (nonatomic, strong) UIView *femaleView;//反费
- @property (nonatomic, strong) UIView *maleView;//反费
- @property (nonatomic, strong) UIView *peopleView;//招聘人数
- @property (nonatomic, strong) UIView *timeView;//时间
- @property (nonatomic, strong) UIView *lineView2;
- @end
- @implementation HJFullTimeDetailHeaderView
- - (instancetype)initWithFrame:(CGRect)frame {
-
- if (self = [super initWithFrame:frame])
- {
- self.backgroundColor = [UIColor whiteColor];
- }
- return self;
- }
- - (void)configurationFullTimeDetailHeaderViewData:(NSDictionary *)data andCollectionButton:(UIButton *)collectionBtn {
-
- for (UIView *subViews in self.subviews)
- {
- [subViews removeFromSuperview];
- }
-
- self.titleView = data[kHJPositionKeyTitle];
- self.salaryView = data[kHJPositionKeySalary];
- self.femaleView = data[kHJPositionKeyFemaleReward];
- self.maleView = data[kHJPositionKeyMaleReward];
- self.peopleView = data[kHJPositionKeyRecruitAndDate];
- self.timeView = data[kHJPositionKeyTime];
-
- [self addSubview:self.topView];
- [self.topView addSubview:self.lineView1];
- if (!self.maleView.hidden)
- {
- [self.topView addSubview:self.maleView];
- }
- if (!self.femaleView.hidden)
- {
- [self.topView addSubview:self.femaleView];
- }
-
- [self.topView addSubview:self.titleView];
- [self.topView addSubview:self.salaryView];
- [self.topView addSubview:self.peopleView];
- [self.topView addSubview:self.timeView];
- [self.topView addSubview:self.lineView2];
- [self.topView addSubview:collectionBtn];
-
- [self.topView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.mas_top).with.offset(0);
- make.left.right.equalTo(self).offset(0);
- make.bottom.equalTo(self.mas_bottom).offset(0);
- }];
- [self.titleView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.topView).with.offset(15);
- make.left.equalTo(self.topView).with.offset(15);
- }];
- [self.salaryView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.equalTo(self.titleView);
- make.right.equalTo(self.topView).with.offset(-15);
- make.left.greaterThanOrEqualTo(self.titleView.mas_right);
- make.width.mas_greaterThanOrEqualTo(140);
- }];
-
- [self.peopleView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.titleView);
- make.top.equalTo(self.titleView.mas_bottom).with.offset(6);
- }];
- [self.timeView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.equalTo(self.salaryView);
- make.centerY.equalTo(self.peopleView);
- }];
-
- [self.lineView1 mas_makeConstraints:^(MASConstraintMaker *make) {
-
- make.left.equalTo(self.topView).offset(0);
- make.right.equalTo(self.topView).offset(0);
- make.height.mas_equalTo(1);
- make.top.equalTo(self.peopleView.mas_bottom).offset(15);
- }];
-
- [collectionBtn mas_makeConstraints:^(MASConstraintMaker *make) {
-
- make.top.equalTo(self.lineView1.mas_bottom).offset(9);
- make.right.equalTo(self.topView.mas_right).offset(-15);
- }];
- [self.lineView2 mas_makeConstraints:^(MASConstraintMaker *make) {
-
- make.left.equalTo(self.topView).offset(0);
- make.right.equalTo(self.topView).offset(0);
- make.height.mas_equalTo(1);
- make.top.equalTo(collectionBtn.mas_bottom).offset(9);
- make.bottom.equalTo(self.topView.mas_bottom).offset(0);
- }];
-
- if ([self.topView.subviews indexOfObject:self.maleView] != NSNotFound)
- {
- [self.topView addSubview:self.feeLabel];
-
- [self.feeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.lineView1.mas_bottom).with.offset(10);
- make.left.equalTo(self.titleView);
- make.size.mas_offset(CGSizeMake(35, 20));
- make.bottom.equalTo(self.topView.mas_bottom).offset(-15);
- }];
- [self.maleView mas_makeConstraints:^(MASConstraintMaker *make) {
-
- make.centerY.equalTo(self.feeLabel);
- make.left.equalTo(self.feeLabel.mas_right).offset(10);
- }];
-
- if ([self.topView.subviews indexOfObject:self.femaleView] != NSNotFound)
- {
- [self.femaleView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.equalTo(self.maleView);
- make.left.equalTo(self.maleView.mas_right).with.offset(5);
- }];
- }
- }
- else
- {
- if ([self.topView.subviews indexOfObject:self.femaleView] != NSNotFound)
- {
- [self.topView addSubview:self.feeLabel];
-
- [self.feeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.lineView1.mas_bottom).with.offset(10);
- make.left.equalTo(self.titleView);
- make.size.mas_offset(CGSizeMake(35, 20));
- make.bottom.equalTo(self.topView.mas_bottom).offset(-15);
- }];
- [self.femaleView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.equalTo(self.feeLabel);
- make.left.equalTo(self.feeLabel.mas_right).offset(10);
- }];
- }
- }
- }
- #pragma mark - lazy
- - (UIView *)topView {
-
- if (_topView == nil)
- {
- _topView = [[UIView alloc]init];
- _topView.backgroundColor = [UIColor whiteColor];
- }
- return _topView;
- }
- - (UILabel *)feeLabel {
-
- if (_feeLabel == nil)
- {
- _feeLabel = [[UILabel alloc]init];
- _feeLabel.text = @"奖励";
- _feeLabel.textAlignment = NSTextAlignmentCenter;
- _feeLabel.layer.cornerRadius =3;
- _feeLabel.layer.masksToBounds = YES;
- _feeLabel.font = [UIFont systemFontOfSize:12];
- _feeLabel.textColor = [UIColor whiteColor];
- _feeLabel.backgroundColor = COLOR_FE7235;
- }
- return _feeLabel;
- }
- - (UIView *)lineView1 {
-
- if (_lineView1 == nil)
- {
- _lineView1 = [[UIView alloc] init];
- _lineView1.backgroundColor = COLOR_EEEEEE;
- }
- return _lineView1;
- }
- - (UIView *)lineView2 {
-
- if (_lineView2 == nil)
- {
- _lineView2 = [[UIView alloc] init];
- _lineView2.backgroundColor = COLOR_EEEEEE;
- }
- return _lineView2;
- }
- @end
|