2019-12-12 OC cell自适应高度
2019-12-12 本文已影响0人
浪高达
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
NSDictionary * dic = _commentsArray[indexPath.row];
NSString * comment = dic[@"content"];
CGRect contentRect = [comment boundingRectWithSize:CGSizeMake(kWidth - 85, 9999) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:14]} context:nil];
CGFloat heiht = 47;
heiht += CGRectGetHeight(contentRect);
if (heiht > 67) {
return heiht;
}
return 67;
}