//获取评论内容 根据内容来设置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;

}

相关文章:

  • 2021-07-10
  • 2021-07-04
  • 2022-12-23
  • 2021-12-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-26
相关资源
相似解决方案