KWMTBVSectionHeardView.m 1.97 KB
Newer Older
houweibin committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
//
//  KWMTBVSectionHeardView.m
//  iCemarose
//
//  Created by 陈荣科 on 16/9/1.
//  Copyright © 2016年 kollway. All rights reserved.
//

#import "KWMTBVSectionHeardView.h"
#import "KWMStringUtil.h"

@implementation KWMTBVSectionHeardView

- (instancetype)init{
    if (self = [super init]) {
        [self initContentView];
    }
    return self;
}

- (instancetype)initWithCoder:(NSCoder *)aDecoder{

    if (self = [super initWithCoder:aDecoder]) {
        [self initContentView];
    }
    return self;
}

- (instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        [self initContentView];
    }
    return self;
}

- (void)awakeFromNib{
    [super awakeFromNib];
    [self initContentView];
}

- (void)initContentView{
    [[NSBundle mainBundle] loadNibNamed:@"KWMTBVSectionHeardView" owner:self options:nil];
    [self addSubview:self.vContent];
    self.vContent.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
45
//    self.vLine.backgroundColor = [UIColor colorWithRed:241.0/255 green:242.0/255 blue:243.0/255 alpha:1];
houweibin committed
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
    UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onClickWacthMore:)];
    self.ivMore.userInteractionEnabled = YES;
    [self.ivMore addGestureRecognizer:tapGesture];
}

- (void)setGoodsModel:(KWMNewGoodsModel *)goodsModel{
    _goodsModel = goodsModel;
    if (goodsModel) {
        if (goodsModel.chineseName != nil && ![goodsModel.chineseName isEqualToString:@""]) {
            _lbSectionTitel.text = _goodsModel.chineseName;
        }else{
            _lbSectionTitel.text = _goodsModel.title;
        }
    }
}

62 63 64 65
- (void)setTitle:(NSString *)title {
    _lbSectionTitel.text = title;
}

houweibin committed
66 67 68 69 70 71 72
- (void)onClickWacthMore:(UITapGestureRecognizer *)tapGesture{
    if ([self.delegate respondsToSelector:@selector(kwm_watchMoreProductsByBrand:AndTitle:)]) {
        [self.delegate kwm_watchMoreProductsByBrand:_goodsModel AndTitle:_lbSectionTitel.text];
    }
}

@end