123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- //
- // KBFindNavBarView.m
- // YouHuiProject
- //
- // Created by xiaoxi on 2018/1/19.
- // Copyright © 2018年 kuxuan. All rights reserved.
- //
- #import "KBFindNavBarView.h"
- @implementation KBFindNavBarView
- - (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.leftLabel];
- [self addSubview:self.rightButton];
- [self addSubview:self.bottomButton];
-
- [self.leftLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self).offset(FITSIZE(15));
- make.top.equalTo(self).offset(FITSIZE(58));
- }];
-
- [self.rightButton mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.equalTo(self).offset(-FITSIZE(15));
- make.top.equalTo(self).offset(FITSIZE(55));
- make.size.mas_equalTo(CGSizeMake(FITSIZE(110), FITSIZE(26)));
- }];
-
- [self.bottomButton mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self).offset(FITSIZE(15));
- make.bottom.equalTo(self).offset(-FITSIZE(12));
- make.right.equalTo(self).offset(-FITSIZE(15));
- make.height.mas_equalTo(FITSIZE(36));
- }];
- }
- - (void)helpButtonAction {
- if ([self.delegate respondsToSelector:@selector(yh_FinNavBarViewClickHelp)]) {
- [self.delegate yh_FinNavBarViewClickHelp];
- }
- }
- - (void)searchButtonAction {
- if ([self.delegate respondsToSelector:@selector(yh_FindNavBarViewClickSearch)]) {
- [self.delegate yh_FindNavBarViewClickSearch];
- }
- }
- #pragma mark - lazy
- - (UILabel *)leftLabel {
- if (!_leftLabel) {
- _leftLabel = [[UILabel alloc] init];
- _leftLabel.backgroundColor = [UIColor clearColor];
- _leftLabel.textColor = [UIColor whiteColor];
- _leftLabel.font = [UIFont systemFontOfSize:FITSIZE(20)];
- }
- return _leftLabel;
- }
- - (UIButton *)rightButton {
- if (!_rightButton) {
- _rightButton = [UIButton buttonWithType:UIButtonTypeCustom];
- _rightButton.backgroundColor = [UIColor clearColor];
- _rightButton.layer.cornerRadius = FITSIZE(13);
- _rightButton.layer.borderColor = [UIColor whiteColor].CGColor;
- _rightButton.layer.borderWidth = 1;
- [_rightButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
- [_rightButton setTitle:@"淘宝查券指南" forState:UIControlStateNormal];
- [_rightButton setImage:[UIImage imageNamed:@"forward"] forState:UIControlStateNormal];
- _rightButton.titleLabel.font = [UIFont systemFontOfSize:FITSIZE(12)];
- [_rightButton addTarget:self action:@selector(helpButtonAction) forControlEvents:UIControlEventTouchUpInside];
- [_rightButton setButtonStyle:WSLButtonStyleImageRight spacing:-10];
- }
- return _rightButton;
- }
- - (UIButton *)bottomButton {
- if (!_bottomButton) {
- _bottomButton = [UIButton buttonWithType:UIButtonTypeCustom];
- _bottomButton.backgroundColor = [[UIColor whiteColor] colorWithAlphaComponent:0.3];
- [_bottomButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
- [_bottomButton setTitle:@"输入商品名或粘贴淘宝标题" forState:UIControlStateNormal];
- [_bottomButton setImage:[UIImage imageNamed:@"search_small"] forState:UIControlStateNormal];
- _bottomButton.titleLabel.font = [UIFont systemFontOfSize:FITSIZE(14)];
- [_bottomButton addTarget:self action:@selector(searchButtonAction) forControlEvents:UIControlEventTouchUpInside];
- [_bottomButton setButtonStyle:WSLButtonStyleImageLeft spacing:FITSIZE(10)];
- }
- return _bottomButton;
- }
- @end
|