WorkFlowSearchView.m 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. //
  2. // WorkFlowSearchView.m
  3. // smartRhino
  4. //
  5. // Created by tederen on 2019/11/5.
  6. // Copyright © 2019 tederen. All rights reserved.
  7. //
  8. #import "WorkFlowSearchView.h"
  9. @interface WorkFlowSearchView()
  10. @property (nonatomic, strong) TDButton *titleButton;
  11. @property (nonatomic, strong) TDButton *numberButton;
  12. @property (nonatomic, strong) TDButton *textButton;
  13. @property (nonatomic, strong) TDButton *opinionButton;
  14. @property (nonatomic, strong) TDButton *Button;
  15. @property (nonatomic, strong) UILabel *titlelab;
  16. @property (nonatomic, strong) UIView *leftView;
  17. @property (nonatomic, strong) UIView *rightView;
  18. @end
  19. @implementation WorkFlowSearchView
  20. - (instancetype)initWithFrame:(CGRect)frame
  21. {
  22. self = [super initWithFrame:frame];
  23. if (self) {
  24. self.backgroundColor = [UIColor whiteColor];
  25. self.layer.cornerRadius = 5;
  26. self.layer.masksToBounds = YES;
  27. CGFloat topMargin = 13.5;
  28. CGFloat leftMargin1 = 0;
  29. CGFloat width = self.bounds.size.width;
  30. CGFloat height = self.bounds.size.height;
  31. CGFloat lineWidh = width/4;
  32. CGFloat lineToText = 12;
  33. [self addSubview:self.titlelab];
  34. CGSize titleSize = [self.titlelab sizeThatFits:CGSizeZero];
  35. self.titlelab.frame = CGRectMake(width/2 - titleSize.width/2 ,topMargin,titleSize.width, titleSize.height);
  36. topMargin += titleSize.height/2;
  37. [self addSubview:self.leftView];
  38. leftMargin1 = (width - lineWidh - lineWidh - titleSize.width -lineToText)/2;
  39. self.leftView.frame = CGRectMake(leftMargin1,topMargin,lineWidh, 1);
  40. leftMargin1 += lineWidh;
  41. leftMargin1 += lineToText;
  42. leftMargin1 += titleSize.width;
  43. [self addSubview:self.rightView];
  44. self.rightView.frame = CGRectMake(leftMargin1,topMargin,lineWidh, 1);
  45. topMargin += titleSize.height/2;
  46. topMargin += 30;
  47. [self addSubview:self.titleButton];
  48. [self addSubview:self.numberButton];
  49. [self addSubview:self.textButton];
  50. [self addSubview:self.opinionButton];
  51. CGFloat leftMargin2 = 30;
  52. CGFloat buttonSpace = 20;
  53. CGFloat buttonWidth = (width - leftMargin2 -leftMargin2 - buttonSpace - buttonSpace - buttonSpace)/4;
  54. self.titleButton.frame = CGRectMake(leftMargin2,45.f,buttonWidth, buttonWidth);
  55. leftMargin2 += buttonWidth;
  56. leftMargin2 += buttonSpace;
  57. self.numberButton.frame = CGRectMake(leftMargin2,45.f,buttonWidth, buttonWidth);
  58. leftMargin2 += buttonWidth;
  59. leftMargin2 += buttonSpace;
  60. self.textButton.frame = CGRectMake(leftMargin2,45.f,buttonWidth, buttonWidth);
  61. leftMargin2 += buttonWidth;
  62. leftMargin2 += buttonSpace;
  63. self.opinionButton.frame = CGRectMake(leftMargin2,45.f,buttonWidth, buttonWidth);
  64. }
  65. return self;
  66. }
  67. - (TDButton *)titleButton{
  68. if (!_titleButton) {
  69. _titleButton = [[TDButton alloc]init];
  70. [_titleButton setTitle:@"审批标题" forState:UIControlStateNormal];
  71. [_titleButton setImage:IMG(@"审批标题") forState:UIControlStateNormal];
  72. [[_titleButton titleLabel] setFont:[UIFont systemFontOfSize:13.f]];
  73. [_titleButton setTitleColor:UIColorHex(999999) forState:UIControlStateNormal];
  74. [_titleButton addTarget:self action:@selector(ButtonHander:) forControlEvents:UIControlEventTouchDown];
  75. [_titleButton layoutButtonWithEdgeInsetsStyle:GLButtonEdgeInsetsStyleTop imageTitleSpace:20];
  76. // [_titleButton setImageEdgeInsets:UIEdgeInsetsMake(0, 14, 13, 14)];
  77. }
  78. return _titleButton;
  79. }
  80. - (TDButton *)numberButton{
  81. if (!_numberButton) {
  82. _numberButton = [[TDButton alloc]init];
  83. [_numberButton setTitle:@"审批编号" forState:UIControlStateNormal];
  84. [_numberButton setImage:IMG(@"审批编号") forState:UIControlStateNormal];
  85. [[_numberButton titleLabel] setFont:[UIFont systemFontOfSize:13.f]];
  86. [_numberButton setTitleColor:UIColorHex(999999) forState:UIControlStateNormal];
  87. [_numberButton addTarget:self action:@selector(ButtonHander:) forControlEvents:UIControlEventTouchDown];
  88. [_numberButton layoutButtonWithEdgeInsetsStyle:GLButtonEdgeInsetsStyleTop imageTitleSpace:20];
  89. }
  90. return _numberButton;
  91. }
  92. - (TDButton *)textButton{
  93. if (!_textButton) {
  94. _textButton = [[TDButton alloc]init];
  95. [_textButton setTitle:@"正文内容" forState:UIControlStateNormal];
  96. [_textButton setImage:IMG(@"正文内容") forState:UIControlStateNormal];
  97. [[_textButton titleLabel] setFont:[UIFont systemFontOfSize:13.f]];
  98. [_textButton setTitleColor:UIColorHex(999999) forState:UIControlStateNormal];
  99. [_textButton addTarget:self action:@selector(ButtonHander:) forControlEvents:UIControlEventTouchDown];
  100. [_textButton layoutButtonWithEdgeInsetsStyle:GLButtonEdgeInsetsStyleTop imageTitleSpace:20];
  101. }
  102. return _textButton;
  103. }
  104. - (TDButton *)opinionButton{
  105. if (!_opinionButton) {
  106. _opinionButton = [[TDButton alloc]init];
  107. [_opinionButton setTitle:@"审批意见" forState:UIControlStateNormal];
  108. [_opinionButton setImage:IMG(@"审批意见") forState:UIControlStateNormal];
  109. [[_opinionButton titleLabel] setFont:[UIFont systemFontOfSize:13.f]];
  110. [_opinionButton setTitleColor:UIColorHex(999999) forState:UIControlStateNormal];
  111. [_opinionButton addTarget:self action:@selector(ButtonHander:) forControlEvents:UIControlEventTouchDown];
  112. [_opinionButton layoutButtonWithEdgeInsetsStyle:GLButtonEdgeInsetsStyleTop imageTitleSpace:20];
  113. }
  114. return _opinionButton;
  115. }
  116. - (void)ButtonHander:(TDButton *)Button{
  117. if ([self.delegate respondsToSelector:@selector(didSelectWorkFlowSearchViewAction:)]) {
  118. [self.delegate didSelectWorkFlowSearchViewAction:Button];
  119. }
  120. }
  121. - (UIView *)leftView{
  122. if (!_leftView) {
  123. _leftView = [[UIView alloc]init];
  124. _leftView.backgroundColor = UIColorHex(E6E6E6);
  125. }
  126. return _leftView;
  127. }
  128. - (UILabel *)titlelab{
  129. if (!_titlelab) {
  130. _titlelab = [UILabel new];
  131. _titlelab.text = @"在这里可以搜索到";
  132. _titlelab.font = [UIFont systemFontOfSize:12.f];
  133. _titlelab.textColor = k6;
  134. }
  135. return _titlelab;
  136. }
  137. - (UIView *)rightView{
  138. if (!_rightView) {
  139. _rightView = [[UIView alloc]init];
  140. _rightView.backgroundColor = UIColorHex(E6E6E6);
  141. }
  142. return _rightView;
  143. }
  144. @end