// // cateCell.m // ThePaperBase // // Created by YoungLee on 15/8/6. // Copyright (c) 2015年 scar1900. All rights reserved. // #import "cateCell.h" @interface cateCell() @property(nonatomic, strong)UIButton *backView; //@property(nonatomic, strong)UILabel *chnName; //@property(nonatomic, strong)UILabel *enName; @end @implementation cateCell @synthesize cateBo = _cateBo; -(instancetype)initWithFrame:(CGRect)frame{ self = [super initWithFrame:frame]; if (self) { self.backgroundColor = [UIColor colorWithHexString:BackGroundColor]; [self.contentView addSubview:self.chnName]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(needrefreshNightMode:) name:REFRESHAFTERNIGHTMODE object:nil]; } return self; } - (void)needrefreshNightMode:(id)sender{ self.backgroundColor = [UIColor colorWithHexString:BackGroundColor]; self.chnName.textColor = [UIColor colorWithHexString:TextBlack]; } #pragma mark -- set DATA -(void)setCateBo:(categoryBO *)bo{ _cateBo = bo; self.chnName.text = _cateBo.name; } #pragma mark -- view -(UILabel *)chnName{ if (!_chnName) { _chnName = [[UILabel alloc] initWithFrame:CGRectZero]; _chnName.textColor = [UIColor colorWithHexString:TextBlack]; _chnName.font = appFont(16, NO); _chnName.textAlignment = NSTextAlignmentCenter; } return _chnName; } -(UILabel *)enName{ if (!_enName) { _enName = [[UILabel alloc] initWithFrame:CGRectZero]; _enName.textColor = [UIColor colorWithHexString:TextLightGray]; _enName.font = appFont(5, NO); _enName.textAlignment = NSTextAlignmentCenter; _enName.userInteractionEnabled = NO; } return _enName; } //-(void)setHighlighted:(BOOL)highlighted{ // //// highlighted = !highlighted; // if (highlighted) { // self.backgroundColor = [UIColor colorWithHexString:BLUECOLOR]; // self.chnName.textColor = [UIColor whiteColor]; // self.enName.textColor = [UIColor whiteColor]; // }else{ // self.backgroundColor = [UIColor whiteColor]; // self.chnName.textColor = [UIColor colorWithHexString:TextBlack]; // self.enName.textColor = [UIColor colorWithHexString:TextLightGray]; // } // [super setHighlighted:highlighted]; //} #pragma mark -- layout -(void)layoutSubviews{ __weak typeof(self) weakSelf = self; [self.chnName remakeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(weakSelf.contentView.left); make.right.equalTo(weakSelf.contentView.right); make.height.equalTo(@17); make.centerY.equalTo(weakSelf.contentView.centerY); }]; // [self.enName makeConstraints:^(MASConstraintMaker *make) { // make.left.equalTo(weakSelf.contentView.left); // make.right.equalTo(weakSelf.contentView.right); // make.top.equalTo(@0); // make.height.equalTo(@6); // }]; } @end