计算单元格的高度

-(CGFloat)cellHeightWithString:(NSString *)string {

NSStringDrawingOptions options =NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading;

NSDictionary *attribute = @{NSFontAttributeName: [UIFont systemFontOfSize:14.0]};

CGSize contentSize = [string boundingRectWithSize:CGSizeMake(220.0, 9999.0) options:options attributes:attribute context:nil].size;

CGFloat contentHeight = contentSize.height;

return contentHeight;

}

你可能感兴趣的:(计算单元格的高度)