I was trying to find a clean way to change the cell height based on a large variable length label I have in a custom cell. I found this and it worked like a charm.
Apple - Support - Discussions - UITableView variable row height ...
Note sponnos post (second from the bottom):
Code:
- (CGFloat) tableView: (UITableView *) tableView heightForRowAtIndexPath: (NSIndexPath *) indexPath
{
// Use the method that you would have created above to get the cell.
// Any other method seems to result in infinite recursion like you said.
TweetCell *cell = (TweetCell*)[self tableView:tableView cellForRowAtIndexPath:indexPath];
NSString *text = cell.textView.text; //[[menuList objectAtIndex:indexPath.row] objectForKey:@"status"];
CGFloat height = [text sizeWithFont:cell.textView.font constrainedToSize:CGSizeMake(240,70) lineBreakMode:UILineBreakModeWordWrap].height;
//return MAX(height, MinHeight);
return height+30;
}