|
//
// AnswerQuoCommentCell.m
// ThePaperBase
//
// Created by zhousan on 15/11/18.
// Copyright © 2015年 scar1900. All rights reserved.
//
#import "AnswerQuoCommentCell.h"
@implementation AnswerQuoCommentCell
- (void)setIsComment:(BOOL)isComment {
_isComment = isComment;
if (_isComment) {
self.lineView.hidden = NO;
}
}
- (void)subLayoutSubViews {
__weak typeof(self) weakSelf = self;
[self.backView makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self);
make.bottom.equalTo(self);
make.left.equalTo(self).offset(10);
make.right.equalTo(self).offset(-10);
}];
self.lineView.hidden = YES;
[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);
}];
[self.quoNameLable makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(weakSelf.commentBack.left).offset(10);
make.top.equalTo(weakSelf.commentBack.top).offset(10);
make.width.mas_equalTo(weakSelf.commentBack).offset(-15);
make.height.mas_equalTo(25/2);
}];
[self.triangleImg makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.commentBack.left).offset(55/2);
make.top.equalTo(self.commentBack.top).offset(-6);
make.width.equalTo(@7);
make.height.equalTo(@7);
}];
}
- (void)reLayoutSubViews {
__weak typeof(self) weakSelf = self;
CGFloat backHeight = 50/2+10;
CGFloat labeHeight = 0;
if (self.havePic) {
backHeight += 15/2+quo_pic_width;
}
CGFloat diandianHeight = 0;
if (!self.commentBO.isQuoExpand || [self.commentBO.isQuoExpand intValue] == 0) {
labeHeight = (int)self.commentBO.labelHeight;
CGFloat twoLine = getLineHeightWithCountAndFontWidth(2, 10, TEXT_FOUR_LEVELSIZE);
if (labeHeight > twoLine) {
labeHeight = twoLine;
backHeight += 15;
diandianHeight = 15;
}
backHeight += labeHeight;
}else {
labeHeight = (int)self.commentBO.labelHeight;
backHeight += labeHeight;
}
[self.commentBack remakeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(weakSelf.backView.left).offset(10);
make.top.equalTo(weakSelf.backView.top).offset(10);
make.right.equalTo(weakSelf.backView.right).offset(-10);
make.height.mas_equalTo(backHeight);
}];
[self.quoContentLabel remakeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.commentBack.left).offset(8);
make.top.equalTo(self.quoNameLable.bottom).offset(5);
make.right.equalTo(self.commentBack.right).offset(-8);
make.height.mas_equalTo(labeHeight);
}];
[self.diandiandianLabel remakeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.quoContentLabel.bottom);
make.centerX.equalTo(self.backView);
make.size.mas_equalTo(CGSizeMake(100, diandianHeight));
}];
[self.quoPic1 makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.commentBack.left).offset(10);
make.top.equalTo(self.diandiandianLabel.bottom).offset(15/2);
make.size.mas_equalTo(CGSizeMake(quo_pic_width, quo_pic_width));
}];
[self.quoPic2 makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.quoPic1.right).offset(10);
make.top.equalTo(self.diandiandianLabel.bottom).offset(15/2);
make.size.mas_equalTo(CGSizeMake(quo_pic_width, quo_pic_width));
}];
[self.quoPic3 makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.quoPic2.right).offset(10);
make.top.equalTo(self.diandiandianLabel.bottom).offset(15/2);
make.size.mas_equalTo(CGSizeMake(quo_pic_width, quo_pic_width));
}];
}
@end
|