文字高度

+ (CGFloat)cellHeightWithContent:(NSString *)content{
    CGSize size = [NSString sizeWithText:content andFont:JZGFont(ContentLabelFont) andMaxSize:CGSizeMake(ContentLabelWidth, MAXFLOAT)];
    
    return size.height + 50.0f;
}

NSS t ri n g (tool)

+ (CGSize)sizeWithText:(NSString *)text andFont:(UIFont *)font andMaxSize:(CGSize)maxSize
{
    NSDictionary *attr = @{ NSFontAttributeName:font };
    return [text boundingRectWithSize:maxSize options:NSStringDrawingUsesLineFragmentOrigin attributes:attr context:nil].size;
}
原文地址:https://www.cnblogs.com/mkai/p/6269757.html