我正在尝试UITableView
使用下面的代码动态调整单元格的高度。目前只有return 200;
被调用。
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *description = [photosFromCommentsArray objectAtIndex:indexPath.row];
NSLog(@"description is %@",description);
if(description == NULL)
return 60;
else {
return 200;
}
}
描述的NSLog
输出是:
如您所见,有时在这种情况下我想返回return 60;
,并且当它包含我希望返回的内容之外的其他内容时return 200;
2013-09-12 16:30:36.567 1000 [11619:907] description is <null>
2013-09-12 16:30:36.568 1000 [11619:907] description is <null>
2013-09-12 16:30:36.569 1000 [11619:907] description is <null>
2013-09-12 16:30:36.569 1000 [11619:907] description is <null>
2013-09-12 16:30:36.570 1000 [11619:907] description is (
"http://****.net/uploads/nodes/1464/photos/a0d41e7834b5119884c6fa83aaffb3023f609c0e.jpeg"
)
2013-09-12 16:30:36.571 1000 [11619:907] description is (
"http://****.net/uploads/nodes/1464/photos/739701d7609bcb65ce5293f3551773c6bb6a498d.jpeg"
)
2013-09-12 16:30:36.572 1000 [11619:907] description is (
"http://****.net/uploads/nodes/1464/photos/99cf9e662b0d4f00e316bd2f8c01faddb20e9473.jpeg"
)
2013-09-12 16:30:36.572 1000 [11619:907] description is (
"http://*****.net/uploads/nodes/1464/photos/a6680113da9567b8477810703e14616631c39a06.jpeg"
)