口袋优选

KBHeaderReusableView.m 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. //
  2. // KBHeaderReusableView.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/1/18.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "KBHeaderReusableView.h"
  9. @interface KBHeaderReusableView ()<YHTypeButtonActionDelegate>
  10. @property (nonatomic, strong) KBTypeButtonHeader *selctionHeader;
  11. @end
  12. @implementation KBHeaderReusableView
  13. - (instancetype)initWithFrame:(CGRect)frame {
  14. self = [super initWithFrame:frame];
  15. if (self)
  16. {
  17. self.selctionHeader = [[KBTypeButtonHeader alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 40)];
  18. self.selctionHeader.backgroundColor = [UIColor whiteColor];
  19. [self.selctionHeader setTypeButtonTitles:@[@"推荐",@"最新",@"销量"] withDownLableHeight:0 andDeleagte:self];
  20. [self.selctionHeader setTypeButtonNormalColor:[UIColor YHColorWithHex:0x666666] andSelectColor:[UIColor YHColorWithHex:0xff2420]];
  21. [self addSubview:self.selctionHeader];
  22. }
  23. return self;
  24. }
  25. #pragma mark -----------
  26. - (void)didClickTypeButtonAction:(UIButton *)button withIndex:(NSInteger)index {
  27. if (self.delegate && [self.delegate respondsToSelector:@selector(YHTypeReusableViewDidSelectedIndex:)]) {
  28. [self.delegate YHTypeReusableViewDidSelectedIndex:index];
  29. }
  30. }
  31. @end