|
//
// liveContentCell.m
// ThePaperHD
//
// Created by scar1900 on 15/3/11.
// Copyright (c) 2015年 scar1900. All rights reserved.
//
#import "liveContentCell.h"
#import "contentTextView.h"
#define CONTENTWIDTH rect_screen.size.width-60
#define contentPadding isPad?@"12":@"25"
@interface liveContentCell() {
CGFloat contentHeight;
}
@property(nonatomic, strong)UILabel *contentLabel;
//@property(nonatomic, strong)UIView *lineView;
@end
@implementation liveContentCell
@synthesize dataDic = _dataDic;
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
self.backgroundColor = [UIColor colorWithHexString:BackGroundColor];
self.selectionStyle = UITableViewCellSelectionStyleNone;
[self.contentView addSubview:self.contentLabel];
[self setLayoutSubViews];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(needrefreshNightMode:) name:REFRESHAFTERNIGHTMODE object:nil];
}
return self;
}
- (void)needrefreshNightMode:(id)sender{
self.backgroundColor = [UIColor colorWithHexString:BackGroundColor];
self.contentLabel.textColor = [UIColor colorWithHexString:TextGray];
[self.contentLabel setNeedsDisplay];
}
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
- (UILabel *)contentLabel {
if (!_contentLabel) {
_contentLabel = [[UILabel alloc]initWithFrame:CGRectZero];
_contentLabel.textAlignment = NSTextAlignmentLeft;
_contentLabel.numberOfLines = 0;
_contentLabel.lineBreakMode = NSLineBreakByWordWrapping;
_contentLabel.textColor = [UIColor colorWithHexString:TextGray];
_contentLabel.backgroundColor = [UIColor clearColor];
}
return _contentLabel;
}
- (void)setDataDic:(NSDictionary *)dic {
_dataDic = dic;
NSAttributedString *str = dic[@"text"];
self.contentLabel.attributedText = str;
}
- (void)setLayoutSubViews {
[self.contentLabel remakeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.contentView.left).offset(50);
make.right.mas_equalTo(self.contentView.right).offset(-10);
make.top.mas_equalTo(self.contentView.top);
make.bottom.equalTo(self.contentView.bottom).offset(0-[contentPadding floatValue]);
}];
}
- (void)setRelayoutSubviews {
}
- (void)awakeFromNib {
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
|