口袋优选

KBSearchNoDataView.m 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. //
  2. // KBSearchNoDataView.m
  3. // YouHuiProject
  4. //
  5. // Created by xiaoxi on 2018/2/5.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "KBSearchNoDataView.h"
  9. @implementation KBSearchNoDataView
  10. - (instancetype)initWithFrame:(CGRect)frame {
  11. self = [super initWithFrame:frame];
  12. if (self) {
  13. self.backgroundColor = [UIColor whiteColor];
  14. [self initSubviews];
  15. }
  16. return self;
  17. }
  18. - (void)initSubviews {
  19. UIImageView *topImageView = [[UIImageView alloc] init];
  20. topImageView.backgroundColor = [UIColor clearColor];
  21. topImageView.image = [UIImage imageNamed:@"search_no_data"];
  22. [self addSubview:topImageView];
  23. UILabel *topLabel = [[UILabel alloc] init];
  24. topLabel.backgroundColor = [UIColor clearColor];
  25. topLabel.textColor = [UIColor YHColorWithHex:0x333333];
  26. topLabel.font = [UIFont systemFontOfSize:FITSIZE(14)];
  27. topLabel.text = @"该商品未参加优惠券和返佣推广活动";
  28. [self addSubview:topLabel];
  29. UILabel *middleLabel = [[UILabel alloc] init];
  30. middleLabel.backgroundColor = [UIColor clearColor];
  31. middleLabel.textColor = [UIColor YHColorWithHex:0x888888];
  32. middleLabel.font = [UIFont systemFontOfSize:FITSIZE(14)];
  33. middleLabel.text = @"建议亲换个店铺试试";
  34. [self addSubview:middleLabel];
  35. UIButton *bottomButton = [UIButton buttonWithType:UIButtonTypeCustom];
  36. bottomButton.backgroundColor = [UIColor clearColor];
  37. [bottomButton setTitleColor:[UIColor YHColorWithHex:0x666666] forState:UIControlStateNormal];
  38. bottomButton.titleLabel.font = [UIFont systemFontOfSize:FITSIZE(15)];
  39. [bottomButton setTitle:@"刷新" forState:UIControlStateNormal];
  40. bottomButton.layer.borderWidth = 1.0f;
  41. bottomButton.layer.borderColor = [UIColor YHColorWithHex:0xb3b3b3].CGColor;
  42. bottomButton.layer.cornerRadius = 3.0f;
  43. [bottomButton addTarget:self action:@selector(refreshButtonAction) forControlEvents:UIControlEventTouchUpInside];
  44. [self addSubview:bottomButton];
  45. [topImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  46. make.centerX.equalTo(self);
  47. make.top.equalTo(self).offset(FITSIZE(30));
  48. }];
  49. [topLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  50. make.centerX.equalTo(self);
  51. make.top.equalTo(topImageView.mas_bottom).offset(FITSIZE(22));
  52. }];
  53. [middleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  54. make.centerX.equalTo(self);
  55. make.top.equalTo(topLabel.mas_bottom).offset(FITSIZE(6));
  56. }];
  57. [bottomButton mas_makeConstraints:^(MASConstraintMaker *make) {
  58. make.centerX.equalTo(self);
  59. make.top.equalTo(middleLabel.mas_bottom).offset(FITSIZE(20));
  60. make.width.mas_equalTo(FITSIZE(102));
  61. make.height.mas_equalTo(FITSIZE(30));
  62. }];
  63. }
  64. - (void)refreshButtonAction {
  65. if ([self.delegate respondsToSelector:@selector(yh_SearchNoDataViewDidRefresh)]) {
  66. [self.delegate yh_SearchNoDataViewDidRefresh];
  67. }
  68. }
  69. @end