|
//
// TopicAnswerContTabCell.m
// ThePaperBase
//
// Created by zhousan on 15/11/24.
// Copyright © 2015年 scar1900. All rights reserved.
//
#import "TopicAnswerContTabCell.h"
@implementation TopicAnswerContTabCell
@synthesize commentBO;
- (void)setCommentBO:(commentObjectVO *)data {
commentBO = data;
CGFloat trueContentHeight= (int)self.commentBO.labelHeight;
CGFloat fourLine = getLineHeightWithCountAndFontWidth(4, 10, TEXT_FOUR_LEVELSIZE);
if (!data.isExpand || [data.isExpand intValue] == 0) {
self.cellHeight = trueContentHeight>fourLine?fourLine:trueContentHeight;
}else {
self.cellHeight = trueContentHeight;
}
self.aswerContentLabel.text = data.content;
if (trueContentHeight > fourLine) {
self.expandBtn.hidden = NO;
}else self.expandBtn.hidden = YES;
if (data.quoteInfo.allKeys.count>0 || data.imageList.count > 0 || [data.hasMore isEqualToString:@"1"]) {//TODO当有图片的时候也应该隐藏线
self.lineView.hidden = YES;
}else self.lineView.hidden = NO;
if (self.shouldNoHiddenLine != nil) {
if ([self.shouldNoHiddenLine isEqualToString:@"1"]) {
self.lineView.hidden = NO;
}else self.lineView.hidden = YES;
}
if ([data.hiddenLine isEqualToString:@"1"]) {
self.lineView.hidden = YES;
}
self.aswerContentLabel.textColor = [UIColor colorWithHexString:ANSWERBLUECOLOR];
[self reLayoutSubViews];
}
- (void)reLayoutSubViews {
__weak typeof(self) weakSelf = self;
self.expandBtn.hidden = YES;
[self.aswerContentLabel remakeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(weakSelf.backView.left).offset(10);
make.right.equalTo(weakSelf.backView.right).offset(-10);
make.top.equalTo(weakSelf.backView.top);
make.height.mas_equalTo(self.commentBO.labelHeight);
}];
[self.lineView makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.backView);
make.width.mas_equalTo(rect_screen.size.width-20);
make.bottom.equalTo(weakSelf.backView.bottom);
make.height.mas_equalTo(1);
}];
}
- (void)commentBack:(id)sender {
UIMenuController *menu = [UIMenuController sharedMenuController];
if (menu.menuVisible) {
[menu setMenuVisible:NO animated:YES];
}
if ([self.delegate respondsToSelector:@selector(gotoCommentWithCommentBO:comment2:)]) {
[self.delegate gotoCommentWithCommentBO:self.commentBO comment2:self.commentNext];
};
}
@end
|