KWMBarandSelectView.m 1.8 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
//
//  KWMBarandSelectView.m
//  iCemarose
//
//  Created by 陈荣科 on 16/8/29.
//  Copyright © 2016年 kollway. All rights reserved.
//

#import "KWMBarandSelectView.h"
#import "KWMShopCartData.h"

@implementation KWMBarandSelectView{
    BOOL isShow;
}

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

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

houweibin committed
30 31 32 33
- (void)layoutSubviews
{
    [super layoutSubviews];
    self.vContent.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
houweibin committed
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
}

- (void)initContentView{
    [[NSBundle mainBundle] loadNibNamed:@"KWMBarandSelectView" owner:self options:nil];
    [self addSubview:_vContent];
    
    self.vContent.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
    isShow = NO;
    [self.lbBrand sizeToFit];
    _lbCount.text = @"0";
}

- (void)setCount:(NSInteger)count{
    _count = count;
    if (count > 0) {
        _lbCount.text = [NSString stringWithFormat:@"%@",@(count).stringValue];
        if (count > 9) {
            _lbCount.font = [UIFont systemFontOfSize:8];
        }
    }else{
         _lbCount.text = @"0";
    }
}
//点击购物车
- (IBAction)onClickShopCartBtn:(id)sender {
    NSLog(@"点击了购物车");
    if ([self.delegate respondsToSelector:@selector(kwm_HitShopCartBtn)]) {
        [self.delegate kwm_HitShopCartBtn];
    }
}

lee committed
65 66 67 68
- (IBAction)onClickSearchBtn:(id)sender {
    [self.delegate kwm_hitSearchBtn];
}

houweibin committed
69 70 71 72 73 74 75
- (IBAction)onClickBackBtn:(id)sender {
    NSLog(@"点击了返回按钮");
    if ([self.delegate respondsToSelector:@selector(kwm_clickBackBtn)]) {
        [self.delegate kwm_clickBackBtn];
    }
}
@end