// // CommentSubModel.m // smartRhino // // Created by tederen on 2019/10/29. // Copyright © 2019 tederen. All rights reserved. // #import "CommentSubModel.h" @implementation CommentSubModel - (CGFloat)getCellHeight{ UILabel *textLabel = [UILabel new]; textLabel.numberOfLines = 0; textLabel.font = [UIFont systemFontOfSize:17.5f]; CGFloat height = 0; if (ISEmptyString(self.ReplyName)) { textLabel.text = [NSString stringWithFormat:@"%@:%@",self.Name,self.Content]; }else{ textLabel.text = [NSString stringWithFormat:@"%@ 回复 %@:%@",self.Name,self.ReplyName,self.Content]; } if (!ISEmptyString(self.Content)){ [ZYCTool setLabel:textLabel withSpace:10.f withFont:textLabel.font setLineSpace:0 setTextSpace:2.f]; } CGFloat nameWith = [self calculateName:self.Name]; CGFloat withFloat = kGXScreenWidth-68-28 - nameWith; CGSize textSize = [textLabel sizeThatFits:CGSizeMake(withFloat, MAXFLOAT)]; height += textSize.height + 15; return height; } - (CGFloat)calculateName:(NSString *)name{ UILabel *textLabel = [UILabel new]; textLabel.numberOfLines = 0; textLabel.font = [UIFont systemFontOfSize:17.5f]; textLabel.text = [NSString stringWithFormat:@"%@:",name]; CGSize textSize = [textLabel sizeThatFits:CGSizeMake(kGXScreenWidth, MAXFLOAT)]; return textSize.width; } @end