【发布时间】:2016-04-11 08:57:31
【问题描述】:
我想通过使用自动布局根据文本量来更改我的表格视图单元格的高度。我尝试了以下代码,但它不起作用:
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
AddTaskDetails *addTaskDetail = (self.tasksArray)[indexPath.row];
CGFloat height;
float textcount = [addTaskDetail.taskDetail length];
if(textcount>60)
{
height = textcount-20;
NSLog(@"%d,%f",indexPath.row,height);
}
else
{
height = 70;
}
return height;
}
【问题讨论】:
标签: ios objective-c uitableview autolayout