使用boundingRectWithSize计算内容高度的

NSDictionary *attributes = @{NSFontAttributeName:[UIFontsystemFontOfSize:16]};

    CGRect comm_content_rect = [@"" boundingRectWithSize:CGSizeMake(UIScreen.mainScreen.bounds.size.width-20, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:attributes context:nil];
    return comm_content_rect.size.height+100;

你可能感兴趣的:(object-c)