123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- //
- // KBSearchNoDataView.m
- // YouHuiProject
- //
- // Created by xiaoxi on 2018/2/5.
- // Copyright © 2018年 kuxuan. All rights reserved.
- //
- #import "KBSearchNoDataView.h"
- @implementation KBSearchNoDataView
- - (instancetype)initWithFrame:(CGRect)frame {
- self = [super initWithFrame:frame];
- if (self) {
- self.backgroundColor = [UIColor whiteColor];
-
- [self initSubviews];
- }
- return self;
- }
- - (void)initSubviews {
- UIImageView *topImageView = [[UIImageView alloc] init];
- topImageView.backgroundColor = [UIColor clearColor];
- topImageView.image = [UIImage imageNamed:@"search_no_data"];
- [self addSubview:topImageView];
-
- UILabel *topLabel = [[UILabel alloc] init];
- topLabel.backgroundColor = [UIColor clearColor];
- topLabel.textColor = [UIColor YHColorWithHex:0x333333];
- topLabel.font = [UIFont systemFontOfSize:FITSIZE(14)];
- topLabel.text = @"该商品未参加优惠券和返佣推广活动";
- [self addSubview:topLabel];
-
- UILabel *middleLabel = [[UILabel alloc] init];
- middleLabel.backgroundColor = [UIColor clearColor];
- middleLabel.textColor = [UIColor YHColorWithHex:0x888888];
- middleLabel.font = [UIFont systemFontOfSize:FITSIZE(14)];
- middleLabel.text = @"建议亲换个店铺试试";
- [self addSubview:middleLabel];
-
- UIButton *bottomButton = [UIButton buttonWithType:UIButtonTypeCustom];
- bottomButton.backgroundColor = [UIColor clearColor];
- [bottomButton setTitleColor:[UIColor YHColorWithHex:0x666666] forState:UIControlStateNormal];
- bottomButton.titleLabel.font = [UIFont systemFontOfSize:FITSIZE(15)];
- [bottomButton setTitle:@"刷新" forState:UIControlStateNormal];
- bottomButton.layer.borderWidth = 1.0f;
- bottomButton.layer.borderColor = [UIColor YHColorWithHex:0xb3b3b3].CGColor;
- bottomButton.layer.cornerRadius = 3.0f;
- [bottomButton addTarget:self action:@selector(refreshButtonAction) forControlEvents:UIControlEventTouchUpInside];
- [self addSubview:bottomButton];
-
- [topImageView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.equalTo(self);
- make.top.equalTo(self).offset(FITSIZE(30));
- }];
-
- [topLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.equalTo(self);
- make.top.equalTo(topImageView.mas_bottom).offset(FITSIZE(22));
- }];
-
- [middleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.equalTo(self);
- make.top.equalTo(topLabel.mas_bottom).offset(FITSIZE(6));
- }];
-
- [bottomButton mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.equalTo(self);
- make.top.equalTo(middleLabel.mas_bottom).offset(FITSIZE(20));
- make.width.mas_equalTo(FITSIZE(102));
- make.height.mas_equalTo(FITSIZE(30));
- }];
- }
- - (void)refreshButtonAction {
- if ([self.delegate respondsToSelector:@selector(yh_SearchNoDataViewDidRefresh)]) {
- [self.delegate yh_SearchNoDataViewDidRefresh];
- }
- }
- @end
|