热更新demo

userInfoBaseCell.m 3.6KB

    // // userInfoBaseCell.m // ThePaperDemo // // Created by scar1900 on 14/12/11. // Copyright (c) 2014年 scar1900. All rights reserved. // #import "userInfoBaseCell.h" @interface userInfoBaseCell() @end @implementation userInfoBaseCell - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(needrefreshNightMode) name:REFRESHAFTERNIGHTMODE object:nil]; self.backgroundColor = [UIColor clearColor]; UIView *selectView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.bounds), CGRectGetHeight(self.bounds))]; selectView.backgroundColor = [UIColor colorWithHexString:CELLBACKCOLOR]; //bug5238: 个人信息页点击效果的颜色 self.selectedBackgroundView = selectView; [self addSubview:self.titleLabel]; [self addSubview:self.pushIcon]; [self addSubview:self.lineView]; [self layoutViews]; } return self; } - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; } - (void)needrefreshNightMode { _titleLabel.textColor = [UIColor colorWithHexString:TextBlack]; _lineView.backgroundColor = [UIColor colorWithHexString:LINECOLOR]; UIView *selectView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.bounds), CGRectGetHeight(self.bounds))]; selectView.backgroundColor = [UIColor colorWithHexString:CELLBACKCOLOR]; //bug5238: 个人信息页点击效果的颜色 self.selectedBackgroundView = selectView; [self needrefreshSubNightMode]; } - (void)needrefreshSubNightMode { } - (void)layoutViews { [self.titleLabel makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.top); make.left.equalTo(self.left).offset(10); make.right.equalTo(self.right).offset(-20); }]; [self.pushIcon makeConstraints:^(MASConstraintMaker *make) { make.centerY.equalTo(self.titleLabel.centerY); make.right.equalTo(self.right).offset(-10); make.width.mas_equalTo(@10); make.height.mas_equalTo(@16); }]; [self.lineView makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.titleLabel.bottom); make.left.equalTo(self.left).offset(10); make.right.equalTo(self.right); make.bottom.equalTo(self.bottom); make.height.mas_equalTo(@0.5); }]; } - (void)setTitle:(NSString *)titleStr { _title = titleStr; self.titleLabel.text = titleStr; } - (UILabel*)titleLabel { if (!_titleLabel) { _titleLabel = [[UILabel alloc]initWithFrame:CGRectZero]; _titleLabel.textAlignment = NSTextAlignmentLeft; _titleLabel.textColor = [UIColor colorWithHexString:TextBlack]; _titleLabel.backgroundColor = [UIColor clearColor]; _titleLabel.font = appFont(TEXT_FOUR_LEVELSIZE, NO); } return _titleLabel; } - (UIImageView*)pushIcon { if (!_pushIcon) { _pushIcon = [[UIImageView alloc]initWithFrame:CGRectZero]; _pushIcon.image = Image(@"login/pushIcon.png"); } return _pushIcon; } - (UIView*)lineView { if (!_lineView) { _lineView = [[UIView alloc]initWithFrame:CGRectZero]; _lineView.backgroundColor = [UIColor colorWithHexString:LINECOLOR]; } return _lineView; } - (void)awakeFromNib { // Initialization code } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } @end