// 设置行高
// 首先要设置显示多行 cell.textLabel.numberOfLines = 0;
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
// 获取要显示的文本字符串
NSString *text = [_listArray objectAtIndex:indexPath.row];
// 根据文本内容字体计算高度,最大高度不超过1000
CGSize size = [text sizeWithFont:[UIFont systemFontOfSize:14] constrainedToSize:CGSizeMake(320, 1000)];
// 20 间隔
return size.height + 20;
}