|
//
// nodeTopicCell.m
// ThePaperBase
//
// Created by scar1900 on 15/8/14.
// Copyright (c) 2015年 scar1900. All rights reserved.
//
#import "nodeTopicCell.h"
@interface nodeTopicCell()
@property(nonatomic, strong)UILabel *titleLabel;
@property(nonatomic, strong)UILabel *assistLabel;
@end
@implementation nodeTopicCell
@synthesize nodeInfoBO = _nodeInfoBO;
- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
self.layer.borderColor = [UIColor colorWithHexString:LINECOLOR].CGColor;
self.layer.borderWidth = 0.5;
[self addSubview:self.titleLabel];
[self addSubview:self.assistLabel];
[self.titleLabel makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.left);
make.right.equalTo(self.right);
make.centerY.equalTo(self.centerY);
make.height.equalTo(@20);
}];
[self.assistLabel makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.left);
make.right.equalTo(self.right);
make.top.equalTo(self.titleLabel.bottom).offset(3);
make.height.equalTo(@20);
}];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(refreshAfterOpenNightMode:) name:REFRESHAFTERNIGHTMODE object:nil];
}
return self;
}
- (void)setHighlighted:(BOOL)highlighted {
[super setHighlighted:highlighted];
if (highlighted) {
self.backgroundColor = [UIColor colorWithHexString:GRAYCOLOR];
}else {
self.backgroundColor = [UIColor colorWithHexString:BackGroundColor];
}
}
- (void)setNodeInfoBO:(nodeObjectBO *)data {
_nodeInfoBO = data;
self.titleLabel.text = data.name;
self.assistLabel.text = data.enname;
}
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [UILabel new];
_titleLabel.backgroundColor = [UIColor clearColor];
_titleLabel.textAlignment = NSTextAlignmentCenter;
_titleLabel.textColor = [UIColor colorWithHexString:TextBlack];
}
_titleLabel.font = appFont(TEXT_ONE_PLUS_LEVELSIZE, NO);
return _titleLabel;
}
- (UILabel *)assistLabel {
if (!_assistLabel) {
_assistLabel = [UILabel new];
_assistLabel.backgroundColor = [UIColor clearColor];
_assistLabel.textAlignment = NSTextAlignmentCenter;
_assistLabel.textColor = [UIColor colorWithHexString:TextLightGray];
}
_assistLabel.font = appFont(TEXT_SEVEN_LEVELSIZE, NO);
return _assistLabel;
}
- (void)layoutSubviews {
[super layoutSubviews];
self.assistLabel.textColor = [UIColor colorWithHexString:TextLightGray];
self.titleLabel.textColor = [UIColor colorWithHexString:TextBlack];
self.backgroundColor = [UIColor colorWithHexString:BackGroundColor];
self.layer.borderColor = [UIColor colorWithHexString:LINECOLOR].CGColor;
self.layer.borderWidth = 0.5;
}
- (void)refreshAfterOpenNightMode:(NSNotification*)noti {
self.assistLabel.textColor = [UIColor colorWithHexString:TextLightGray];
self.titleLabel.textColor = [UIColor colorWithHexString:TextBlack];
self.backgroundColor = [UIColor colorWithHexString:BackGroundColor];
self.layer.borderColor = [UIColor colorWithHexString:LINECOLOR].CGColor;
self.layer.borderWidth = 0.5;
}
- (void)dealloc {
[[NSNotificationCenter defaultCenter]removeObserver:self];
}
@end
|