美文网首页
2019-12-12 OC cell自适应高度

2019-12-12 OC cell自适应高度

作者: 浪高达 | 来源:发表于2019-12-12 15:42 被阅读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;
}

相关文章

网友评论

      本文标题:2019-12-12 OC cell自适应高度

      本文链接:https://www.haomeiwen.com/subject/jejtnctx.html