I have the classical grouped UITableView with editable UITextViews inside every cell. This text views can be single or multi-lined, and I want the cell to increase its heigh
To be more specific, yes, you have to implement tableView:heightForRowAtIndexPath:
to calculate the new height, then do as rickharrison says and call [tableView reloadRowsAtIndexPaths:withRowAnimation]
. Lets say your cells can have an expanded height and a normal height, and you want them to grow when tapped on. You can do:
-(CGFloat)tableView:(UITableView*)tableView heightForRowAtIndexPath:(NSIndexPath*) indexPath
{
if ([expandedPaths containsObject:indexPath]) {
return 80;
} else {
return 44;
}
}
-(void)tableView:(UITableView*) didSelectRowAtIndexPath:(NSIndexPath*) indexPath
{
[expandedPaths addObject:indexPath];
[tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
}