|
//
// channelListCell.m
// ThePaperDemo
//
// Created by Scar on 14-9-4.
// Copyright (c) 2014年 scar1900. All rights reserved.
//
#import "channelListCell.h"
#import "channnelListHeadCell.h"
@interface channelListCell() {
CGFloat imageHeight;
NSString *imageID;
nodeObjectBO *nodeBO;
NSAttributedString *attributedStr;
BOOL isHaveCornerLabelDesc;
TopicInfoBO *topicBO;
commentObjectVO *commentBO;
NSAttributedString *hotInfoText;
}
@end
@implementation channelListCell
@synthesize dataBO = _dataBO;
@synthesize titleHeight;
@synthesize hotInfoHeight;
@synthesize hotInfo;
@synthesize delegate;
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
// Initialization code
self.contentView.backgroundColor = [UIColor colorWithHexString:CELLBACKCOLOR];
self.selectionStyle = UITableViewCellSelectionStyleNone;
[self.contentView addSubview:self.backView];
[self.backView addSubview:self.titleLabel];
[self.backView addSubview:self.imgView];
[self.backView addSubview:self.sortLabel];
[self.backView addSubview:self.timeImg];
[self.backView addSubview:self.timeLabel];
[self.backView addSubview:self.commentImg];
[self.backView addSubview:self.commentLabel];
[self.backView addSubview:self.tpLabel];
[self.backView addSubview:self.hotInfoBtn];
[self.hotInfoBtn addSubview:self.hotInfoLabel];
[self.imgView addSubview:self.videoView];
[self.imgView addSubview:self.videoImg];
[self.imgView addSubview:self.videoDurationLabel];
[self.imgView addSubview:self.imageBgView];
[self.imageBgView addSubview:self.imageSetImg];
[self.imageBgView addSubview:self.imgeSetNumLabel];
[self setSubviewsLayout];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(needrefreshNightMode:) name:REFRESHAFTERNIGHTMODE object:nil];
}
return self;
}
- (UILabel*)sortLabel {
if (!_sortLabel) {
_sortLabel = [UILabel new];
_sortLabel.textAlignment = NSTextAlignmentCenter;
_sortLabel.textColor = [UIColor colorWithHexString:TextLightGray];
_sortLabel.backgroundColor = [UIColor colorWithHexString:BackGroundColor];
}
_sortLabel.font = appFont(9, NO);
return _sortLabel;
}
- (UIImageView*)timeImg {
if (!_timeImg) {
_timeImg = [UIImageView new];
if ([[TPUserDefault instance].isNightMode intValue] == 0) {
_timeImg.image = Image(@"frontPage/time_img.png");
}else {
_timeImg.image = Image(@"frontPage/time_img_night.png");
}
_timeImg.backgroundColor = [UIColor colorWithHexString:BackGroundColor];
}
return _timeImg;
}
- (UIImageView*)commentImg {
if (!_commentImg) {
_commentImg = [UIImageView new];
if ([[TPUserDefault instance].isNightMode intValue] == 0) {
_commentImg.image = Image(@"frontPage/comment_img.png");
}else {
_commentImg.image = Image(@"frontPage/comment_img_night.png");
}
_commentImg.backgroundColor = [UIColor colorWithHexString:BackGroundColor];
}
return _commentImg;
}
- (UIView*)backView {
if (!_backView) {
_backView = [[UIView alloc]initWithFrame:CGRectZero];
_backView.backgroundColor = [UIColor colorWithHexString:BackGroundColor];
UIView *lineView1 = [[UIView alloc]initWithFrame:CGRectZero];
lineView1.tag = 2001;
lineView1.backgroundColor = [UIColor colorWithHexString:LINECOLOR];
[_backView addSubview:lineView1];
}
return _backView;
}
- (AsyncImageView*)imgView {
if (!_imgView) {
_imgView = [[AsyncImageView alloc]initWithFrame:CGRectZero];
_imgView.backgroundColor = [UIColor colorWithHexString:BackGroundColor];
}
return _imgView;
}
- (UILabel*)titleLabel {
if (!_titleLabel) {
_titleLabel = [UILabel new];
_titleLabel.textAlignment = NSTextAlignmentLeft;
_titleLabel.lineBreakMode = NSLineBreakByCharWrapping;
_titleLabel.numberOfLines = 0;
_titleLabel.backgroundColor = [UIColor colorWithHexString:BackGroundColor];
_titleLabel.textColor = [UIColor colorWithHexString:TextBlack];
}
return _titleLabel;
}
- (UILabel*)timeLabel {
if (!_timeLabel) {
_timeLabel = [[UILabel alloc]initWithFrame:CGRectZero];
_timeLabel.textAlignment = NSTextAlignmentCenter;
_timeLabel.textColor = [UIColor colorWithHexString:TextLightGray];
_timeLabel.backgroundColor = [UIColor colorWithHexString:BackGroundColor];
}
_timeLabel.font = appFont(TEXT_SEVEN_LEVELSIZE, NO);
return _timeLabel;
}
- (UILabel*)commentLabel {
if (!_commentLabel) {
_commentLabel = [[UILabel alloc]initWithFrame:CGRectZero];
_commentLabel.textAlignment = NSTextAlignmentLeft;
_commentLabel.textColor = [UIColor colorWithHexString:TextLightGray];
_commentLabel.backgroundColor = [UIColor colorWithHexString:BackGroundColor];
}
_commentLabel.font = appFont(TEXT_SEVEN_LEVELSIZE, NO);
return _commentLabel;
}
- (TPLabel*)tpLabel {
if (!_tpLabel) {
_tpLabel = [[TPLabel alloc]initWithFrame:CGRectZero];
}
_tpLabel.titleLabel.font = appFont(TEXT_SEVEN_LEVELSIZE, NO);
return _tpLabel;
}
- (UIButton*)hotInfoBtn {
if (!_hotInfoBtn) {
_hotInfoBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[_hotInfoBtn addTarget:self action:@selector(goToHotInfo:) forControlEvents:UIControlEventTouchUpInside];
UIImageView *dashedLine = [UIImageView new];
dashedLine.image = Image(@"topic/dottedLine.png");
dashedLine.userInteractionEnabled = YES;
[_hotInfoBtn addSubview:dashedLine];
[dashedLine makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(_hotInfoBtn.left);
make.right.equalTo(_hotInfoBtn.right);
make.top.equalTo(_hotInfoBtn.top);
make.height.equalTo(1);
}];
self.bracketsLabel.font = appFont(TEXT_SIX_LEVELSIZE, NO);
_hotInfoBtn.backgroundColor = [UIColor colorWithHexString:BackGroundColor];
[_hotInfoBtn setBackgroundImage:imageWithUIColor([UIColor colorWithHexString:BackGroundColor])
forState:UIControlStateNormal];
[_hotInfoBtn setBackgroundImage:imageWithUIColor([UIColor colorWithHexString:CELLBACKCOLOR])
forState:UIControlStateHighlighted];
self.bracketsImageView = [UIImageView new];
self.bracketsImageView.userInteractionEnabled = YES;
self.bracketsImageView.backgroundColor = [UIColor clearColor];
self.bracketsImageView.image = Image(@"frontPage/brackets.png");
[_hotInfoBtn addSubview:self.bracketsImageView];
[self.bracketsImageView makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.hotInfoBtn.left).offset(10);
make.top.equalTo(self.hotInfoBtn.top).offset(13);
make.width.mas_equalTo(57/2);
make.height.mas_equalTo(21/2);
}];
self.bracketsLabel = [UILabel new];
self.bracketsLabel.userInteractionEnabled = NO;
self.bracketsLabel.font = appFont(TEXT_SIX_LEVELSIZE, NO);
self.bracketsLabel.textColor = [UIColor colorWithHexString:BLUECOLOR];
self.bracketsLabel.textAlignment = NSTextAlignmentCenter;
self.bracketsLabel.backgroundColor = [UIColor clearColor];
[_hotInfoBtn addSubview:self.bracketsLabel];
[self.bracketsLabel makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.bracketsImageView);
}];
self.hotInfoLine = [UIView new];
self.hotInfoLine.backgroundColor = [UIColor colorWithHexString:LINECOLOR];
[_hotInfoBtn addSubview:self.hotInfoLine];
[self.hotInfoLine makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.hotInfoBtn.left);
make.right.equalTo(self.hotInfoBtn.right);
make.bottom.equalTo(self.hotInfoBtn.bottom);
make.height.equalTo(@0.5);
}];
/**
* bug:5345
*/
}
return _hotInfoBtn;
}
- (UILabel*)hotInfoLabel {
if (!_hotInfoLabel) {
_hotInfoLabel = [UILabel new];
_hotInfoLabel.backgroundColor = [UIColor clearColor];
// _hotInfoLabel.font = appFont(TEXT_FIVE_LEVELSIZE, NO);
_hotInfoLabel.textAlignment = NSTextAlignmentLeft;
_hotInfoLabel.lineBreakMode = NSLineBreakByWordWrapping;
_hotInfoLabel.numberOfLines = 0;
_hotInfoLabel.userInteractionEnabled = NO;
// _hotInfoLabel.lineSpacing = 6;
_hotInfoLabel.textColor = [UIColor colorWithHexString:TextGray];
}
return _hotInfoLabel;
}
- (UIImageView*)videoView {
if (!_videoView) {
_videoView = [[UIImageView alloc]initWithFrame:CGRectZero];
//【需求】列表页 视频图集水印压图有渐变阴影效果(bug:6007)
_videoView.image = Image(@"frontPage/videoBG.png");
// _videoView.backgroundColor = [UIColor redColor];
// _videoView.alpha = 0.6;
_videoView.hidden = YES;
}
return _videoView;
}
- (UIImageView*)videoImg {
if (!_videoImg) {
_videoImg = [[UIImageView alloc]initWithImage:Image(@"detailPage/videoIcon.png")];
_videoImg.hidden = YES;
}
return _videoImg;
}
- (UILabel*)videoDurationLabel {
if (!_videoDurationLabel) {
_videoDurationLabel = [[UILabel alloc]initWithFrame:CGRectZero];
_videoDurationLabel.font = appFont(TEXT_SEVEN_LEVELSIZE, NO);
_videoDurationLabel.textColor = [UIColor whiteColor];
_videoDurationLabel.backgroundColor = [UIColor clearColor];
_videoDurationLabel.textAlignment = NSTextAlignmentCenter;
_videoDurationLabel.hidden = YES;
}
return _videoDurationLabel;
}
-(UIImageView *)imageBgView{
if (!_imageBgView) {
_imageBgView = [[UIImageView alloc] initWithImage:Image(@"detailPage/imageListBg.png")];
_imageBgView.hidden = YES;
}
return _imageBgView;
}
- (UIImageView*)imageSetImg {
if (!_imageSetImg) {
_imageSetImg = [[UIImageView alloc]initWithImage:Image(@"detailPage/imageListPrint.png")];
_imageSetImg.hidden = YES;
}
return _imageSetImg;
}
- (UILabel*)imgeSetNumLabel {
if (!_imgeSetNumLabel) {
_imgeSetNumLabel = [[UILabel alloc]initWithFrame:CGRectZero];
_imgeSetNumLabel.font = appFont(TEXT_SIX_LEVELSIZE, NO);
_imgeSetNumLabel.textColor = [UIColor whiteColor];
_imgeSetNumLabel.backgroundColor = [UIColor clearColor];
_imgeSetNumLabel.textAlignment = NSTextAlignmentLeft;
_imgeSetNumLabel.hidden = YES;
}
return _imgeSetNumLabel;
}
- (void)setDataBO:(listContObjectVO *)data {
if (!data) {
return;
}
_dataBO = data;
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
topicBO = setJsonDicToDataModel(data.hotTopic, [TopicInfoBO class]);
commentBO = setJsonDicToDataModel(data.hotQaInfo, [commentObjectVO class]);
isHaveCornerLabelDesc = YES;
if (isBlankString(data.cornerLabelDesc)) {
isHaveCornerLabelDesc = NO;
}
nodeBO = nil;
if (data.nodeInfo && [data.nodeInfo isKindOfClass:[NSDictionary class]]) {
nodeBO = setJsonDicToDataModel(data.nodeInfo, [nodeObjectBO class]);
}
imageID = getImageNameFromURL(data.pic);
attributedStr = [[NSAttributedString alloc]init];
if ([self isKindOfClass:[channnelListHeadCell class]]) {
attributedStr = getLineSpaceAttributedString(data.name?data.name:@"",
[iphoneLineSpaceAndParaSpace returnLevel7LineSpace],
appFont([iphoneLineSpaceAndParaSpace returnLevel7FontSize], NO));
}else {
attributedStr = getLineSpaceAttributedString(data.name,
[iphoneLineSpaceAndParaSpace returnLevel5LineSpace],
appFont([iphoneLineSpaceAndParaSpace returnLevel5FontSize], NO));
}
hotInfoText = [[NSAttributedString alloc]init];
if (data.hotTopic.allKeys.count > 0 ) {
hotInfoText = getLineSpaceAttributedString(topicBO.title?topicBO.title:@"",
[iphoneLineSpaceAndParaSpace returnLevel2Plus5LineSpace],
appFont([iphoneLineSpaceAndParaSpace returnLevel2Plus5FontSize], NO));
}else if (data.hotQaInfo.allKeys.count > 0) {
hotInfoText = getLineSpaceAttributedString(commentBO.content?commentBO.content:@"",
[iphoneLineSpaceAndParaSpace returnLevel2Plus5LineSpace],
appFont([iphoneLineSpaceAndParaSpace returnLevel2Plus5FontSize], NO));
}else {
hotInfoText = [[NSAttributedString alloc]init];
}
NSInvocationOperation *operation = [[NSInvocationOperation alloc]initWithTarget:self
selector:@selector(readyToReLayout)
object:nil];
[[TPUserDefault instance].globalQueue addOperation:operation];
// dispatch_async(dispatch_get_main_queue(), ^{
// [self updateCellUI];
// });
});
// if (data.watermark && [data.watermark intValue] == 1) {
//// self.imgView.isVideo = YES;
// }else {
//// self.imgView.isVideo = NO;
// }
}
- (void)readyToReLayout {
[self performSelectorOnMainThread:@selector(updateCellUI) withObject:nil waitUntilDone:YES];
// usleep(1);
}
- (void)updateCellUI{
// dispatch_async(dispatch_get_main_queue(), ^{
if (![TPUserDefault instance].isOffline) {
if ([[TPUserDefault instance].readModeStr intValue] == imageMode) {
self.imgView.hidden = NO;
self.imgView.imageUrl = _dataBO.pic;
self.imgView.imageId = imageID;
imageHeight = 125*rectScale();
}else if ([[TPUserDefault instance].readModeStr intValue] == textMode) {
self.imgView.hidden = YES;
imageHeight = 0;
}else {
if ([Remote IsEnableWIFI]) {
self.imgView.hidden = NO;
self.imgView.imageUrl = _dataBO.pic;
self.imgView.imageId = imageID;
imageHeight = 125*rectScale();
}else {
self.imgView.hidden = YES;
imageHeight = 0;
}
}
}else {
self.imgView.hidden = NO;
self.imgView.imageUrl = _dataBO.pic;
self.imgView.imageId = imageID;
imageHeight = 125*rectScale();
}
self.titleLabel.attributedText = attributedStr;
self.timeLabel.text = _dataBO.pubTime;
if ([_dataBO.interactionNum intValue] >=10 || [_dataBO.interactionNum isMatchedByRegex:@"k"]
||[_dataBO.interactionNum isMatchedByRegex:@"m"]) {
self.commentImg.hidden = NO;
self.commentLabel.hidden = NO;
}else{
self.commentImg.hidden = YES;
self.commentLabel.hidden = YES;
}
self.commentLabel.text = _dataBO.interactionNum;
if (isHaveCornerLabelDesc) {
self.tpLabel.hidden = NO;
self.tpLabel.titleLabel.text = _dataBO.cornerLabelDesc;
}else {
self.tpLabel.hidden = YES;
}
if (nodeBO) {
self.sortLabel.text = nodeBO.name;
}
if ([channelListMethodModel checkIsHaveRead:_dataBO.forwordNodeId]) {
self.titleLabel.textColor = [UIColor colorWithHexString:LIGHTGRAY];
}else {
self.titleLabel.textColor = [UIColor colorWithHexString:TextBlack];
}
if (_dataBO.watermark) {
if ([_dataBO.watermark intValue] == 1) {//视频
self.videoView.hidden = NO;
self.videoImg.hidden = NO;
self.videoDurationLabel.hidden = NO;
self.imageBgView.hidden = YES;
self.imageSetImg.hidden = YES;
self.imgeSetNumLabel.hidden = YES;
self.videoDurationLabel.text = _dataBO.duration;
}else if ([_dataBO.watermark intValue] == 2){//图集
self.videoView.hidden = YES;
self.videoImg.hidden = YES;
self.videoDurationLabel.hidden = YES;
self.imageBgView.hidden = NO;
self.imageSetImg.hidden = NO;
self.imgeSetNumLabel.hidden = NO;
self.imgeSetNumLabel.text = _dataBO.imageNum;
}else {
self.videoView.hidden = YES;
self.videoImg.hidden = YES;
self.videoDurationLabel.hidden = YES;
self.imgeSetNumLabel.hidden = YES;
self.imageSetImg.hidden = YES;
self.imageBgView.hidden = YES;
}
}else {
self.videoView.hidden = YES;
self.videoImg.hidden = YES;
self.videoDurationLabel.hidden = YES;
self.imgeSetNumLabel.hidden = YES;
self.imageSetImg.hidden = YES;
self.imageBgView.hidden = YES;
}
if (_dataBO.hotTopic.allKeys.count > 0 ) {
hotInfo = topicBO;
self.hotInfoBtn.hidden = NO;
self.hotInfoLabel.attributedText = hotInfoText;
self.bracketsLabel.text = @"问吧";
}else if (_dataBO.hotQaInfo.allKeys.count > 0) {
hotInfo = commentBO;
self.hotInfoBtn.hidden = NO;
self.hotInfoLabel.attributedText = hotInfoText;
self.bracketsLabel.text = @"追问";
}else {
hotInfo = nil;
self.hotInfoBtn.hidden = YES;
}
[self relayoutLabels];
// });
}
- (void)goToHotInfo:(UIButton*)btn {
if (self.dataBO.hotTopic.allKeys.count > 0 ) {
if ([self.delegate respondsToSelector:@selector(channelGotoHotTopic:)]) {
TopicInfoBO *topicInfo = setJsonDicToDataModel(self.dataBO.hotTopic, [TopicInfoBO class]);
[self.delegate channelGotoHotTopic:topicInfo];
}
}else if (self.dataBO.hotQaInfo.allKeys.count > 0) {
if ([self.delegate respondsToSelector:@selector(channelGotoHotAsk:)]) {
[MobClick event:@"8"];
commentObjectVO *commentBO = setJsonDicToDataModel(self.dataBO.hotQaInfo, [commentObjectVO class]);
[self.delegate channelGotoHotAsk:commentBO];
}
}
}
- (void)setSubviewsLayout {
// self.titleLabel.lineSpacing = HeadCardLineSpace;
// self.titleLabel.font = appFont(TEXT_TWO_LEVELSIZE, NO);
// self.hotInfoLabel.font = appFont(TEXT_FIVE_LEVELSIZE, NO);
UIEdgeInsets backViewInset = UIEdgeInsetsMake(10, 10, 0, 10);
[self.backView makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self).offset(backViewInset);
}];
[self.imgView makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.backView.top);
make.left.equalTo(self.backView.left);
make.right.equalTo(self.backView.right);
make.height.mas_equalTo(imageHeight);
}];
[self.titleLabel makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.backView.left).offset(10);
make.top.equalTo(self.imgView.bottom).offset(25/2);
make.right.equalTo(self.backView.right).offset(-10);
}];
// if ([[TPUserDefault instance].isUseSystemFont intValue] == 0) {
// [self setLineSpace:self.titleLabel text:self.titleLabel.text linceSpace:5];
// }else {
// [self setLineSpace:self.titleLabel text:self.titleLabel.text linceSpace:1];
// }
UIView *lineView1 = [self.backView viewWithTag:2001];
[lineView1 makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.backView.left);
make.right.equalTo(self.backView.right);
make.bottom.equalTo(self.backView.bottom);
make.height.equalTo(@0.5);
}];
lineView1.backgroundColor = [UIColor colorWithHexString:LINECOLOR];
[self.sortLabel makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.titleLabel.left);
make.top.equalTo(self.titleLabel.bottom).offset(25/2-3);
make.height.equalTo(@10);
}];
[self.timeImg makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.sortLabel.right).offset(4);
make.top.equalTo(self.sortLabel.top);
make.width.equalTo(@10);
make.height.equalTo(@10);
}];
[self.timeLabel makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.timeImg.right).offset(3);
make.top.equalTo(self.sortLabel.top);
make.height.equalTo(@10);
}];
[self.commentImg makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.timeLabel.right).offset(4);
make.top.equalTo(self.sortLabel.top);
make.width.equalTo(@10);
make.height.equalTo(10);
}];
[self.commentLabel makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.commentImg.right).offset(3);
make.top.equalTo(self.sortLabel.top);
make.width.equalTo(@40);
make.height.equalTo(@10);
}];
[self.tpLabel makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.backView.right).offset(-10);
make.top.equalTo(self.titleLabel.bottom).offset(25/2-7);
make.width.equalTo(@30);
make.height.equalTo(@14);
}];
[self.videoView makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.imgView.right);
make.bottom.equalTo(self.imgView.bottom);
make.width.equalTo(@60);
make.height.equalTo(@25);
}];
[self.videoImg makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.videoView.left).offset(5);
make.centerY.equalTo(self.videoView.centerY);
make.size.mas_equalTo(CGSizeMake(29/2, 29/2));
}];
[self.videoDurationLabel makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.videoImg.right);
make.top.equalTo(self.videoView.top);
make.bottom.equalTo(self.videoView.bottom);
make.right.equalTo(self.videoView.right);
}];
[self.imageBgView makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.imgView.right).offset(-102/2);
make.bottom.equalTo(self.imgView.bottom);
make.size.mas_equalTo(CGSizeMake(102/2, 50/2));
}];
[self.imageSetImg makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.imageBgView.right).offset(-45);
make.bottom.equalTo(self.imageBgView.bottom).offset(-5);
make.size.mas_equalTo(CGSizeMake(20, 33/2));
}];
[self.imgeSetNumLabel makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.imageSetImg.right).offset(3);
make.top.equalTo(self.imageSetImg.top);
make.bottom.equalTo(self.imageSetImg.bottom);
make.right.equalTo(self.imgView.right);
}];
}
- (void)relayoutLabels {
[self.imgView remakeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.backView.top);
make.left.equalTo(self.backView.left);
make.right.equalTo(self.backView.right);
make.height.mas_equalTo(imageHeight);
}];
// self.titleLabel.font = appFont(TEXT_TWO_LEVELSIZE, NO);
// self.hotInfoLabel.font = appFont(TEXT_FIVE_LEVELSIZE, NO);
[self.titleLabel remakeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.backView.left).offset(10);
make.top.equalTo(self.imgView.bottom).offset(25/2);
make.right.equalTo(self.backView.right).offset(-10);
make.height.mas_equalTo(self.titleHeight);
}];
if (hotInfo) {
CGFloat hotBtnHeight = self.hotInfoHeight+20;
[self.hotInfoBtn remakeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.backView.left);
make.right.equalTo(self.backView.right);
make.bottom.equalTo(self.backView.bottom);
make.height.mas_equalTo(hotBtnHeight);
}];
[self.hotInfoLabel remakeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.hotInfoBtn.left).offset(50);
make.right.equalTo(self.hotInfoBtn.right).offset(-10);
make.top.equalTo(self.hotInfoBtn.top).offset(10);
make.height.mas_equalTo(self.hotInfoHeight);
}];
/**
* bug:5902(首页瀑布流:新闻卡片下方挂的【追问】【问吧】右侧间距过小,要扩大)
*/
}
}
- (void)needrefreshNightMode:(id)sender{
self.contentView.backgroundColor = [UIColor colorWithHexString:CELLBACKCOLOR];
self.backView.backgroundColor = [UIColor colorWithHexString:BackGroundColor];
self.timeImg.backgroundColor = [UIColor colorWithHexString:BackGroundColor];
self.sortLabel.textColor = [UIColor colorWithHexString:TextLightGray];
self.sortLabel.backgroundColor = [UIColor colorWithHexString:BackGroundColor];
self.commentImg.backgroundColor = [UIColor colorWithHexString:BackGroundColor];
self.imgView.backgroundColor = [UIColor colorWithHexString:BackGroundColor];
self.titleLabel.backgroundColor = [UIColor colorWithHexString:BackGroundColor];
if ([channelListMethodModel checkIsHaveRead:self.dataBO.forwordNodeId]) {
self.titleLabel.textColor = [UIColor colorWithHexString:LIGHTGRAY];
}else {
self.titleLabel.textColor = [UIColor colorWithHexString:TextBlack];
}
/**
* bug:5332(新闻详情页切换为夜间模式再切换回来,返回到新闻列表页,已读新闻未显示成已读状态(即字体置灰))
*/
self.timeLabel.textColor = [UIColor colorWithHexString:TextLightGray];
self.timeLabel.backgroundColor = [UIColor colorWithHexString:BackGroundColor];
self.commentLabel.textColor = [UIColor colorWithHexString:TextLightGray];
self.commentLabel.backgroundColor = [UIColor colorWithHexString:BackGroundColor];
self.hotInfoLabel.textColor = [UIColor colorWithHexString:TextGray];
self.bracketsLabel.font = appFont(TEXT_SIX_LEVELSIZE, NO);
self.hotInfoBtn.backgroundColor = [UIColor colorWithHexString:BackGroundColor];
[self.hotInfoBtn setBackgroundImage:imageWithUIColor([UIColor colorWithHexString:BackGroundColor])
forState:UIControlStateNormal];
[self.hotInfoBtn setBackgroundImage:imageWithUIColor([UIColor colorWithHexString:CELLBACKCOLOR])
forState:UIControlStateHighlighted];
UIView *lineView1 = [self.backView viewWithTag:2001];
lineView1.backgroundColor = [UIColor colorWithHexString:LINECOLOR];
if ([[TPUserDefault instance].isNightMode intValue] == 0) {
self.timeImg.image = Image(@"frontPage/time_img.png");
}else {
self.timeImg.image = Image(@"frontPage/time_img_night.png");
}
if ([[TPUserDefault instance].isNightMode intValue] == 0) {
self.commentImg.image = Image(@"frontPage/comment_img.png");
}else {
self.commentImg.image = Image(@"frontPage/comment_img_night.png");
}
self.hotInfoLine.backgroundColor = [UIColor colorWithHexString:LINECOLOR];
}
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
- (void)layoutSubviews {
[super layoutSubviews];
}
- (void)awakeFromNib
{
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
|