KWMLeftCategoryCell.m 1.27 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
//
//  KWMLeftCategoryCell.m
//  iCemarose
//
//  Created by HouWeiBin on 2017/6/13.
//  Copyright © 2017年 kollway. All rights reserved.
//

#import "KWMLeftCategoryCell.h"
#import "UIColor+SAMAdditions.h"

@interface KWMLeftCategoryCell()

@property (nonatomic,weak) IBOutlet UIImageView *ivCategory;

@property (nonatomic,weak) IBOutlet UILabel *lbTitle;

houweibin committed
18 19
@property (nonatomic) KWMCategoryModel *category;

20 21 22 23 24 25 26 27 28 29
@end

@implementation KWMLeftCategoryCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.selectedBackgroundView = [[UIView alloc] initWithFrame:self.frame];
    self.selectedBackgroundView.backgroundColor = [UIColor sam_colorWithHex:@"#F4F5F7"];
}

u  
lee committed
30
- (void)fillData:(KWMCategoryModel *)model {
houweibin committed
31
    _category = model;
u  
lee committed
32 33 34 35
    _lbTitle.text = model.title;
    _ivCategory.image = [UIImage imageNamed:model.image];
}

36 37 38
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    UIColor *textColor = selected?[UIColor sam_colorWithHex:@"#F1929A"]:[UIColor sam_colorWithHex:@"#545454"];
houweibin committed
39 40 41 42
    if(self.category){
        UIImage *image = selected?[UIImage imageNamed:self.category.focusImage]:[UIImage imageNamed:self.category.image];
        self.ivCategory.image = image;
    }
43 44 45 46
    self.lbTitle.textColor = textColor;
}

@end