- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
MyInvestModel *model = self.data[indexPath.row];
// //根据内容计算高度
CGRect rect = [model.name boundingRectWithSize:CGSizeMake(CGRectGetWidth(self.frame)-padding*2, MAXFLOAT)
options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading
attributes:@{NSFontAttributeName:[UIFont fontWithName:@"Helvetica-Bold" size:48/3]
} context:nil];
//再加上其他控件的高度得到cell的高度
if (rect.size.height<91) {
return 91;
}
return 120
}
网友评论