+ (CGFloat)heightForContent:(MyMsgTextModel *)content withWidth:(CGFloat)width
{
CGSize contentSize;
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")) {
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc]init];
paragraphStyle.lineBreakMode = NSLineBreakByWordWrapping;
NSDictionary *attributes = @{NSFontAttributeName:CELL_CONTENT_FONT_SIZE};
contentSize = [content.textMsg boundingRectWithSize:CGSizeMake(width, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin attributes:attributes context:nil].size;
}
else{
contentSize = [content.textMsg sizeWithFont:CELL_CONTENT_FONT_SIZE constrainedToSize:CGSizeMake(width, CGFLOAT_MAX) lineBreakMode:NSLineBreakByWordWrapping];
}
return contentSize.height;
}
时间: 2024-11-06 23:00:34