// // MyTDTopicSelectGroupVIew.m // smartRhino // // Created by tederen on 2019/10/31. // Copyright © 2019 tederen. All rights reserved. // #import "MyTDTopicSelectGroupVIew.h" #import "MyTDTopicModel.h" @interface MyTDTopicSelectGroupVIew() @property (nonatomic, strong) UILabel *selectKeyLabel; @property (nonatomic, strong) UILabel *workGroupLab; @property (nonatomic, strong) TDButton *addButton; @property (nonatomic, strong) UIView * lineView; @end @implementation MyTDTopicSelectGroupVIew - (instancetype)initWithFrame:(CGRect)frame{ self = [super initWithFrame:frame]; if (self){ UILabel *selectKeyLabel = [[UILabel alloc]initWithFrame:CGRectMake(15.5, 17.5, 70.5, 15.5)]; selectKeyLabel.textColor = UIColorHex(999999); selectKeyLabel.font = [UIFont systemFontOfSize:16.f]; [self addSubview:selectKeyLabel]; self.selectKeyLabel = selectKeyLabel; [self addSubview:self.lineView]; } return self; } - (void)loadTopicData:(MyTDTopicModel *)model{ self.selectKeyLabel.text = @"选择范围"; for (int i= 0; i < model.workGroupArray.count; i ++) { NSString *nameStr = model.workGroupArray[i]; [self addSubview:self.workGroupLab]; self.workGroupLab.frame = CGRectMake(96, 13, 53, 25); self.workGroupLab.center = self.selectKeyLabel.center; CGRect workFrame = self.workGroupLab.frame; workFrame.origin.x = 96; self.workGroupLab.frame =workFrame; self.workGroupLab.textAlignment = NSTextAlignmentCenter; self.workGroupLab.text = nameStr; } self.addButton.frame = CGRectMake(kGXScreenWidth -21 -15, 0,21, 21); [self.addButton setCurrentButtonHotSize:CGSizeMake(21, 21)]; [self addSubview:self.addButton]; self.addButton.center = self.selectKeyLabel.center; CGRect addButtonframe = self.addButton.frame; addButtonframe.origin.x = kGXScreenWidth -21 -15; self.addButton.frame = addButtonframe; CGRect frame = self.frame; frame.size.height = 53; self.frame = frame; CGRect lineFrame = self.lineView.frame; lineFrame.origin.y = CGRectGetMaxY(self.frame) -1; self.lineView.frame = lineFrame; } - (void)addWorkGroupHander{ } - (UILabel *)workGroupLab { if (!_workGroupLab) { _workGroupLab = [UILabel new]; _workGroupLab.textColor = UIColorHex(0A0A0A); _workGroupLab.backgroundColor = UIColorHex(EBEBEB); _workGroupLab.layer.cornerRadius = 12.5; _workGroupLab.layer.masksToBounds = YES; _workGroupLab.font = [UIFont systemFontOfSize:12.f]; } return _workGroupLab; } - (UIView *)lineView{ if (!_lineView) { _lineView = [UIView new]; _lineView.frame = CGRectMake(15, 0,kGXScreenWidth -30, 1); _lineView.backgroundColor = UIColorHex(B1D8FF); } return _lineView; } - (TDButton *)addButton{ if (!_addButton) { _addButton = [[TDButton alloc]init]; [_addButton setImage:IMG(@"add") forState:UIControlStateNormal]; [_addButton addTarget:self action:@selector(addWorkGroupHander) forControlEvents:UIControlEventTouchDown]; } return _addButton; } @end