Get tableView:heightForRowAtIndexPath: to happen after tableView:cellForRowAtIndexPath:?
- by Triz
I've got some UITableViewCells that need to change their height depending on the length of the strings inside. I'm calculating the necessary height inside tableView:cellForRowAtIndexPath:, and then storing it in a variable (self.specialRowHeight). Then I've got:
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.section == SPECIAL_SECTION) {
return self.specialRowHeight;
}
else {
return 44;
}
}
Except that seems to be getting called before the tableView:cellForRowAtIndexPath: bit, so it's always zero.
Is there a way around this, or perhaps a different way to do it?
Thanks!