123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- //
- // WorkFlowSearchView.m
- // smartRhino
- //
- // Created by tederen on 2019/11/5.
- // Copyright © 2019 tederen. All rights reserved.
- //
- #import "WorkFlowSearchView.h"
- @interface WorkFlowSearchView()
- @property (nonatomic, strong) TDButton *titleButton;
- @property (nonatomic, strong) TDButton *numberButton;
- @property (nonatomic, strong) TDButton *textButton;
- @property (nonatomic, strong) TDButton *opinionButton;
- @property (nonatomic, strong) TDButton *Button;
- @property (nonatomic, strong) UILabel *titlelab;
- @property (nonatomic, strong) UIView *leftView;
- @property (nonatomic, strong) UIView *rightView;
- @end
- @implementation WorkFlowSearchView
- - (instancetype)initWithFrame:(CGRect)frame
- {
- self = [super initWithFrame:frame];
- if (self) {
- self.backgroundColor = [UIColor whiteColor];
- self.layer.cornerRadius = 5;
- self.layer.masksToBounds = YES;
-
- CGFloat topMargin = 13.5;
-
- CGFloat leftMargin1 = 0;
-
-
- CGFloat width = self.bounds.size.width;
-
- CGFloat height = self.bounds.size.height;
- CGFloat lineWidh = width/4;
- CGFloat lineToText = 12;
-
-
- [self addSubview:self.titlelab];
-
- CGSize titleSize = [self.titlelab sizeThatFits:CGSizeZero];
-
- self.titlelab.frame = CGRectMake(width/2 - titleSize.width/2 ,topMargin,titleSize.width, titleSize.height);
-
- topMargin += titleSize.height/2;
-
- [self addSubview:self.leftView];
-
- leftMargin1 = (width - lineWidh - lineWidh - titleSize.width -lineToText)/2;
-
-
- self.leftView.frame = CGRectMake(leftMargin1,topMargin,lineWidh, 1);
-
- leftMargin1 += lineWidh;
-
- leftMargin1 += lineToText;
-
- leftMargin1 += titleSize.width;
-
- [self addSubview:self.rightView];
-
- self.rightView.frame = CGRectMake(leftMargin1,topMargin,lineWidh, 1);
- topMargin += titleSize.height/2;
- topMargin += 30;
-
-
-
-
- [self addSubview:self.titleButton];
- [self addSubview:self.numberButton];
- [self addSubview:self.textButton];
- [self addSubview:self.opinionButton];
- CGFloat leftMargin2 = 30;
- CGFloat buttonSpace = 20;
- CGFloat buttonWidth = (width - leftMargin2 -leftMargin2 - buttonSpace - buttonSpace - buttonSpace)/4;
-
-
- self.titleButton.frame = CGRectMake(leftMargin2,45.f,buttonWidth, buttonWidth);
- leftMargin2 += buttonWidth;
- leftMargin2 += buttonSpace;
- self.numberButton.frame = CGRectMake(leftMargin2,45.f,buttonWidth, buttonWidth);
- leftMargin2 += buttonWidth;
- leftMargin2 += buttonSpace;
- self.textButton.frame = CGRectMake(leftMargin2,45.f,buttonWidth, buttonWidth);
- leftMargin2 += buttonWidth;
- leftMargin2 += buttonSpace;
- self.opinionButton.frame = CGRectMake(leftMargin2,45.f,buttonWidth, buttonWidth);
-
-
-
-
- }
- return self;
- }
- - (TDButton *)titleButton{
- if (!_titleButton) {
- _titleButton = [[TDButton alloc]init];
- [_titleButton setTitle:@"审批标题" forState:UIControlStateNormal];
- [_titleButton setImage:IMG(@"审批标题") forState:UIControlStateNormal];
- [[_titleButton titleLabel] setFont:[UIFont systemFontOfSize:13.f]];
- [_titleButton setTitleColor:UIColorHex(999999) forState:UIControlStateNormal];
- [_titleButton addTarget:self action:@selector(ButtonHander:) forControlEvents:UIControlEventTouchDown];
- [_titleButton layoutButtonWithEdgeInsetsStyle:GLButtonEdgeInsetsStyleTop imageTitleSpace:20];
- // [_titleButton setImageEdgeInsets:UIEdgeInsetsMake(0, 14, 13, 14)];
- }
- return _titleButton;
- }
- - (TDButton *)numberButton{
- if (!_numberButton) {
- _numberButton = [[TDButton alloc]init];
- [_numberButton setTitle:@"审批编号" forState:UIControlStateNormal];
- [_numberButton setImage:IMG(@"审批编号") forState:UIControlStateNormal];
- [[_numberButton titleLabel] setFont:[UIFont systemFontOfSize:13.f]];
- [_numberButton setTitleColor:UIColorHex(999999) forState:UIControlStateNormal];
- [_numberButton addTarget:self action:@selector(ButtonHander:) forControlEvents:UIControlEventTouchDown];
- [_numberButton layoutButtonWithEdgeInsetsStyle:GLButtonEdgeInsetsStyleTop imageTitleSpace:20];
- }
- return _numberButton;
- }
- - (TDButton *)textButton{
- if (!_textButton) {
- _textButton = [[TDButton alloc]init];
- [_textButton setTitle:@"正文内容" forState:UIControlStateNormal];
- [_textButton setImage:IMG(@"正文内容") forState:UIControlStateNormal];
- [[_textButton titleLabel] setFont:[UIFont systemFontOfSize:13.f]];
- [_textButton setTitleColor:UIColorHex(999999) forState:UIControlStateNormal];
- [_textButton addTarget:self action:@selector(ButtonHander:) forControlEvents:UIControlEventTouchDown];
- [_textButton layoutButtonWithEdgeInsetsStyle:GLButtonEdgeInsetsStyleTop imageTitleSpace:20];
- }
- return _textButton;
- }
- - (TDButton *)opinionButton{
- if (!_opinionButton) {
- _opinionButton = [[TDButton alloc]init];
- [_opinionButton setTitle:@"审批意见" forState:UIControlStateNormal];
- [_opinionButton setImage:IMG(@"审批意见") forState:UIControlStateNormal];
- [[_opinionButton titleLabel] setFont:[UIFont systemFontOfSize:13.f]];
- [_opinionButton setTitleColor:UIColorHex(999999) forState:UIControlStateNormal];
- [_opinionButton addTarget:self action:@selector(ButtonHander:) forControlEvents:UIControlEventTouchDown];
- [_opinionButton layoutButtonWithEdgeInsetsStyle:GLButtonEdgeInsetsStyleTop imageTitleSpace:20];
- }
- return _opinionButton;
- }
- - (void)ButtonHander:(TDButton *)Button{
- if ([self.delegate respondsToSelector:@selector(didSelectWorkFlowSearchViewAction:)]) {
- [self.delegate didSelectWorkFlowSearchViewAction:Button];
- }
- }
- - (UIView *)leftView{
- if (!_leftView) {
- _leftView = [[UIView alloc]init];
- _leftView.backgroundColor = UIColorHex(E6E6E6);
-
- }
- return _leftView;
- }
- - (UILabel *)titlelab{
- if (!_titlelab) {
- _titlelab = [UILabel new];
- _titlelab.text = @"在这里可以搜索到";
- _titlelab.font = [UIFont systemFontOfSize:12.f];
- _titlelab.textColor = k6;
- }
- return _titlelab;
- }
- - (UIView *)rightView{
- if (!_rightView) {
- _rightView = [[UIView alloc]init];
- _rightView.backgroundColor = UIColorHex(E6E6E6);
-
- }
- return _rightView;
- }
- @end
|