//
//  ForumCommentListViewModel.m
//  Lighting
//
//  Created by Javen on 2017/4/18.
//  Copyright © 2017年 上海勾芒科技有限公司. All rights reserved.
//

#import "ForumCommentListViewModel.h"
static UILabel *stringLabel = nil;
@implementation ForumCommentListViewModel

- (void)setReplyEntity:(CustomTOForumReplyEntity *)replyEntity {
    _replyEntity = replyEntity;
    self.height = 88;
    if (replyEntity.attachments.count > 0) {
        self.height = 88 + 164;
    }
    
    
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{ //生成一个用于计算文本高度的label
        stringLabel = [[UILabel alloc] init];
        stringLabel.font = [UIFont systemFontOfSize:17];
        stringLabel.numberOfLines = 0;
    });
    stringLabel.text = replyEntity.replyContent;
    self.height = self.height + [stringLabel sizeThatFits:CGSizeMake(ScreenWidth - 40, MAXFLOAT)].height + 16;
    NSLog(@"%f", self.height);
}
@end
