// // KBFindNavBarStaticView.m // YouHuiProject // // Created by xiaoxi on 2018/1/29. // Copyright © 2018年 kuxuan. All rights reserved. // #import "KBFindNavBarStaticView.h" @implementation KBFindNavBarStaticView - (instancetype)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { // self.backgroundColor = [UIColor gradientWidthFromColor:[UIColor YHColorWithHex:0xff7328] toColor:[UIColor YHColorWithHex:0xff1f1f] withWidth:kScreenWidth]; [self initSubviews]; } return self; } - (void)initSubviews { [self addSubview:self.searchButton]; [self.searchButton mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self).offset(FITSIZE(15)); make.bottom.equalTo(self).offset(-7); make.right.equalTo(self).offset(-FITSIZE(15)); make.height.mas_equalTo(30); }]; self.searchButton.layer.cornerRadius = 15; } - (void)searchButtonAction { if ([self.delegate respondsToSelector:@selector(yh_FindNavBarStaticViewClickSearch)]) { [self.delegate yh_FindNavBarStaticViewClickSearch]; } } #pragma mark - lazy - (UIButton *)searchButton { if (!_searchButton) { _searchButton = [UIButton buttonWithType:UIButtonTypeCustom]; _searchButton.backgroundColor = [UIColor YHColorWithHex:0xF5F5F5]; [_searchButton setTitleColor:[UIColor YHColorWithHex:0x999999] forState:UIControlStateNormal]; [_searchButton setTitle:@"输入商品名或粘贴淘宝标题" forState:UIControlStateNormal]; [_searchButton setImage:[UIImage imageNamed:@"search_small"] forState:UIControlStateNormal]; _searchButton.titleLabel.font = [UIFont systemFontOfSize:FITSIZE(14)]; [_searchButton addTarget:self action:@selector(searchButtonAction) forControlEvents:UIControlEventTouchUpInside]; [_searchButton setButtonStyle:WSLButtonStyleImageLeft spacing:FITSIZE(10)]; } return _searchButton; } @end