I have an UITableView which includes a list of UITableViewCells. And I set the heights of UITableViewCells in method (CGFloat)tableView:(UITableView *)tableView height
Return cell's height depending on that index:
CGFloat height = 30.0f;
...
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return indexPath.row == selectedIndex ? height+100 : height;
}
Refresh tableview geometry in didSelectRowAtIndexPath
method (empty block between beginUpdates
and endUpdates
does the trick):
- (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
index = indexPath.row;
[tableView beginUpdates];
[tableView endUpdates];
}
Make your delegate method
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
return the (new) correct height and make the table view reload the given path.