// // PBScheduleHeaderView.m // IphoneBIMe // // Created by ZhangJF on 2022/8/24. // Copyright © 2022 ProBIM. All rights reserved. // #import "PBScheduleHeaderView.h" #import "PBSchedulePlanModel.h" @interface PBScheduleHeaderView() @property (nonatomic, weak) UILabel *nameL; @property (nonatomic, weak) UILabel *dateL; @property (nonatomic, weak) UILabel *placeL; @property (nonatomic, copy) NSString *currentDate; @end @implementation PBScheduleHeaderView - (instancetype)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { [self setupUI]; } return self; } - (void)setupUI { self.backgroundColor = [UIColor whiteColor]; UIView *iconV = [[UIView alloc] init]; iconV.backgroundColor = PBColor(95, 158, 249); [self addSubview:iconV]; [iconV mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self).offset(20); make.size.mas_equalTo(CGSizeMake(6, 20)); make.left.equalTo(self); }]; UILabel *titleL = [UILabel z_labelWithText:@"基本信息" Color:[UIColor z_colorWithR:95 G:158 B:249] isBold:YES Font:18]; [self addSubview:titleL]; [titleL mas_makeConstraints:^(MASConstraintMaker *make) { make.centerY.equalTo(iconV); make.left.equalTo(iconV.mas_right).offset(5); }]; // UILabel *planNameL = [UILabel z_labelWithText:@"计划名称: " Color:[UIColor z_colorWithR:51 G:51 B:51] isBold:YES Font:14]; // [self addSubview:planNameL]; // [planNameL mas_makeConstraints:^(MASConstraintMaker *make) { // make.top.equalTo(iconV.mas_bottom).offset(14); // make.left.equalTo(self).offset(12); // make.height.equalTo(@16); // }]; // UILabel *nameL = [UILabel z_labelWithText:@"新建隆子机场总进度" Color:[UIColor z_colorWithR:108 G:108 B:108] isBold:NO Font:14]; // [self addSubview:nameL]; // [nameL mas_makeConstraints:^(MASConstraintMaker *make) { // make.top.equalTo(planNameL); // make.left.equalTo(planNameL.mas_right); // make.width.equalTo(@(self.width - 120)); // make.height.equalTo(@16); // }]; // UIButton *scanBtn = [UIButton z_bgImageButton:[UIImage imageNamed:@"scan_img"]]; // [scanBtn addTarget:self action:@selector(scanAction) forControlEvents:UIControlEventTouchUpInside]; // [self addSubview:scanBtn]; // [scanBtn mas_makeConstraints:^(MASConstraintMaker *make) { // make.centerY.equalTo(nameL); // make.size.mas_equalTo(CGSizeMake(24, 24)); // make.right.equalTo(self).offset(-12); // }]; // UILabel *fillDateL = [UILabel z_labelWithText:@"填报日期: " Color:[UIColor z_colorWithR:51 G:51 B:51] isBold:YES Font:14]; // [self addSubview:fillDateL]; // [fillDateL mas_makeConstraints:^(MASConstraintMaker *make) { // make.top.equalTo(planNameL.mas_bottom).offset(18); // make.left.equalTo(self).offset(12); // make.height.equalTo(@44); // }]; // UIButton *borderV = [[UIButton alloc] init]; // [borderV addTarget:self action:@selector(chooseDate) forControlEvents:UIControlEventTouchUpInside]; // borderV.layer.cornerRadius = 4; // borderV.layer.borderWidth = 1.f; // borderV.layer.borderColor = [[UIColor z_colorWithR:108 G:108 B:108] CGColor]; // [self addSubview:borderV]; // [borderV mas_makeConstraints:^(MASConstraintMaker *make) { // make.top.equalTo(fillDateL); //// make.left.equalTo(fillDateL.mas_right); // make.right.equalTo(self).offset(-12); // make.height.equalTo(@44); // make.width.equalTo(@(self.width - 98)); // }]; // // UILabel *dateL = [UILabel z_labelWithText:@"" Color:[UIColor z_colorWithR:108 G:108 B:108] isBold:NO Font:14]; // [self addSubview:dateL]; // [dateL mas_makeConstraints:^(MASConstraintMaker *make) { // make.left.equalTo(borderV).offset(12); // make.centerY.equalTo(borderV); // }]; // UIImageView *chooseDateV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"date_btn"]]; // [self addSubview:chooseDateV]; // [chooseDateV mas_makeConstraints:^(MASConstraintMaker *make) { // make.top.equalTo(borderV).offset(10); // make.right.equalTo(borderV).offset(-10); // make.size.mas_equalTo(CGSizeMake(24, 24)); // }]; UILabel *fillPlaceL = [UILabel z_labelWithText:@"填报位置: " Color:[UIColor z_colorWithR:51 G:51 B:51] isBold:YES Font:14]; [self addSubview:fillPlaceL]; [fillPlaceL mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(iconV.mas_bottom).offset(14); make.left.equalTo(self).offset(12); make.height.equalTo(@44); }]; UILabel *placeL = [UILabel z_labelWithText:@"" Color:[UIColor z_colorWithR:108 G:108 B:108] isBold:NO Font:14]; placeL.numberOfLines = 0; placeL.layer.cornerRadius = 4; placeL.layer.borderWidth = 1.f; placeL.layer.borderColor = [[UIColor z_colorWithR:108 G:108 B:108] CGColor]; [self addSubview:placeL]; [placeL mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(fillPlaceL); make.height.equalTo(@44); make.left.equalTo(fillPlaceL.mas_right); make.width.equalTo(@(self.width - 120)); }]; UIButton *scanBtn = [UIButton z_bgImageButton:[UIImage imageNamed:@"scan_img"]]; [scanBtn addTarget:self action:@selector(scanAction) forControlEvents:UIControlEventTouchUpInside]; [self addSubview:scanBtn]; [scanBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.centerY.equalTo(placeL); make.size.mas_equalTo(CGSizeMake(24, 24)); make.right.equalTo(self).offset(-12); }]; UIView *linV = [[UIView alloc] init]; linV.backgroundColor = PBColor(243, 243, 244); [self addSubview:linV]; [linV mas_makeConstraints:^(MASConstraintMaker *make) { make.height.equalTo(@2); make.left.right.bottom.equalTo(self); }]; // self.nameL = nameL; // self.dateL = dateL; self.placeL = placeL; } - (void)chooseDate { if (self.ChooseDate) { self.ChooseDate(); } } - (void)scanAction { if (self.Scanning) { self.Scanning(); } } - (void)setPlace:(NSString *)place { _place = place; self.placeL.text = place; } - (void)setSchedulePlanModel:(PBSchedulePlanModel *)schedulePlanModel { _schedulePlanModel = schedulePlanModel; self.nameL.text = schedulePlanModel.Name; } - (void)setFillDate:(NSString *)fillDate { _fillDate = fillDate; self.dateL.text = fillDate; } /* // Only override drawRect: if you perform custom drawing. // An empty implementation adversely affects performance during animation. - (void)drawRect:(CGRect)rect { // Drawing code } */ @end