//获取评论内容 根据内容来设置label的高度 设置tag值
NSString *string = [NSString stringWithFormat:@"%@",label.text];
CGRect rect = [string boundingRectWithSize:CGSizeMake([UIScreen mainScreen].bounds.size.width -70, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:16]} context:nil];
cell.content.frame = CGRectMake(60, 40,[UIScreen mainScreen].bounds.size.width -70 , rect.size.height);
cell.content.tag = 11;
cell.content.text =string;
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
//根据tag值来获取cell的高度
UILabel *nameLabel = (UILabel *)[self.view viewWithTag:1];
UILabel *contLabel = (UILabel *)[self.view viewWithTag:11];
return nameLabel.frame.size.height+contLabel.frame.size.height + 30;
}