我想你误会tableView:heightForRowAtIndexPath:
被多次调用(一次为每个行的表格)。
如果你的行有不同的高度,那么你需要确定你所在的行和应该具有的高度。
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;
{
CGFloat height;
if (0 == indexPath.row) {
// This is the first row
height = // what ever you want
} else if (1 == indexPath.row) {
// This is the second row
height = // what ever you want
}
return height;
}
如果您稍后决定行需要一个不同的高度,然后它仍然是这个方法需要计算用于每个行正确的高度。你可以强制这个被调用,而无需重新加载tableView像这样
[tableView beginUpdates];
[tableView endUpdates];
你是指当选择第一行吗? – arnoapp 2012-08-06 12:32:18
编号当初始化自己... – 2012-08-06 12:34:18
你能指定什么是你确切的要求。你可以找到一个替代解决方案,而不是在第二行时更改第一行高度。 – Anish 2012-08-06 12:35:26