1. 程式人生 > >使用boundingRectWithSize計算內容高度的

使用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;