// // DRClassifyLeftTableViewCell.m // YouHuiProject // // Created by 小花 on 2018/4/28. // Copyright © 2018年 kuxuan. All rights reserved. // #import "DRClassifyLeftTableViewCell.h" @implementation DRClassifyLeftTableViewCell { UILabel *_titleLabel; UILabel *_bottomLabel; } - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{ if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { [self setupUI]; } return self; } - (void)setupUI{ self.backgroundColor = [UIColor yhGrayColor]; _titleLabel = [[UILabel alloc]init]; _titleLabel.textAlignment = NSTextAlignmentCenter; _titleLabel.textColor = [UIColor blueColor]; _titleLabel.font = [UIFont systemFontOfSize:14]; [self.contentView addSubview:_titleLabel]; _bottomLabel = [[UILabel alloc]init]; _bottomLabel.backgroundColor = [UIColor clearColor]; [self.contentView addSubview:_bottomLabel]; [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.right.top.equalTo(self.contentView); make.bottom.equalTo(self.contentView.mas_bottom).offset(-2); }]; [_bottomLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.bottom.equalTo(self.contentView.mas_bottom); make.size.mas_equalTo(CGSizeMake(40, 2)); make.centerX.equalTo(self.contentView.mas_centerX); }]; } - (void)setTitle:(NSString *)title{ _title = title; _titleLabel.text = title; } - (void)setIsSelect:(BOOL)isSelect{ _isSelect = isSelect; if (isSelect == YES) { _titleLabel.textColor = [UIColor baseColor]; _bottomLabel.backgroundColor = [UIColor baseColor]; self.backgroundColor = [UIColor whiteColor]; }else{ _titleLabel.textColor = [UIColor YHColorWithHex:0x666666]; _bottomLabel.backgroundColor = [UIColor clearColor]; self.backgroundColor = [UIColor yhGrayColor]; } } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } @end