MyTDTopicSelectGroupVIew.m 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. //
  2. // MyTDTopicSelectGroupVIew.m
  3. // smartRhino
  4. //
  5. // Created by tederen on 2019/10/31.
  6. // Copyright © 2019 tederen. All rights reserved.
  7. //
  8. #import "MyTDTopicSelectGroupVIew.h"
  9. #import "MyTDTopicModel.h"
  10. @interface MyTDTopicSelectGroupVIew()
  11. @property (nonatomic, strong) UILabel *selectKeyLabel;
  12. @property (nonatomic, strong) UILabel *workGroupLab;
  13. @property (nonatomic, strong) TDButton *addButton;
  14. @property (nonatomic, strong) UIView * lineView;
  15. @end
  16. @implementation MyTDTopicSelectGroupVIew
  17. - (instancetype)initWithFrame:(CGRect)frame{
  18. self = [super initWithFrame:frame];
  19. if (self){
  20. UILabel *selectKeyLabel = [[UILabel alloc]initWithFrame:CGRectMake(15.5, 17.5, 70.5, 15.5)];
  21. selectKeyLabel.textColor = UIColorHex(999999);
  22. selectKeyLabel.font = [UIFont systemFontOfSize:16.f];
  23. [self addSubview:selectKeyLabel];
  24. self.selectKeyLabel = selectKeyLabel;
  25. [self addSubview:self.lineView];
  26. }
  27. return self;
  28. }
  29. - (void)loadTopicData:(MyTDTopicModel *)model{
  30. self.selectKeyLabel.text = @"选择范围";
  31. for (int i= 0; i < model.workGroupArray.count; i ++) {
  32. NSString *nameStr = model.workGroupArray[i];
  33. [self addSubview:self.workGroupLab];
  34. self.workGroupLab.frame = CGRectMake(96, 13, 53, 25);
  35. self.workGroupLab.center = self.selectKeyLabel.center;
  36. CGRect workFrame = self.workGroupLab.frame;
  37. workFrame.origin.x = 96;
  38. self.workGroupLab.frame =workFrame;
  39. self.workGroupLab.textAlignment = NSTextAlignmentCenter;
  40. self.workGroupLab.text = nameStr;
  41. }
  42. self.addButton.frame = CGRectMake(kGXScreenWidth -21 -15, 0,21, 21);
  43. [self.addButton setCurrentButtonHotSize:CGSizeMake(21, 21)];
  44. [self addSubview:self.addButton];
  45. self.addButton.center = self.selectKeyLabel.center;
  46. CGRect addButtonframe = self.addButton.frame;
  47. addButtonframe.origin.x = kGXScreenWidth -21 -15;
  48. self.addButton.frame = addButtonframe;
  49. CGRect frame = self.frame;
  50. frame.size.height = 53;
  51. self.frame = frame;
  52. CGRect lineFrame = self.lineView.frame;
  53. lineFrame.origin.y = CGRectGetMaxY(self.frame) -1;
  54. self.lineView.frame = lineFrame;
  55. }
  56. - (void)addWorkGroupHander{
  57. }
  58. - (UILabel *)workGroupLab {
  59. if (!_workGroupLab) {
  60. _workGroupLab = [UILabel new];
  61. _workGroupLab.textColor = UIColorHex(0A0A0A);
  62. _workGroupLab.backgroundColor = UIColorHex(EBEBEB);
  63. _workGroupLab.layer.cornerRadius = 12.5;
  64. _workGroupLab.layer.masksToBounds = YES;
  65. _workGroupLab.font = [UIFont systemFontOfSize:12.f];
  66. }
  67. return _workGroupLab;
  68. }
  69. - (UIView *)lineView{
  70. if (!_lineView) {
  71. _lineView = [UIView new];
  72. _lineView.frame = CGRectMake(15, 0,kGXScreenWidth -30, 1);
  73. _lineView.backgroundColor = UIColorHex(B1D8FF);
  74. }
  75. return _lineView;
  76. }
  77. - (TDButton *)addButton{
  78. if (!_addButton) {
  79. _addButton = [[TDButton alloc]init];
  80. [_addButton setImage:IMG(@"add") forState:UIControlStateNormal];
  81. [_addButton addTarget:self action:@selector(addWorkGroupHander) forControlEvents:UIControlEventTouchDown];
  82. }
  83. return _addButton;
  84. }
  85. @end