7
votes

Is there anyway to change the height of a cell dynamically whilst scrolling a UITableView?

I need to change the height of a number of cells when the scroll position reaches a certain point as the user drags it down past the top. I can do this successfully by issuing a reloadData, however it's very abrupt since the cells just vanish.

I've also tried reloading the cells and running the begin/end updates on the table view, however in both cases the animation sends the scroll view back to the top.

I'd like to animate the cell height change without messing up the current content offset of the drag in progress.

Tim

1

1 Answers

0
votes

Use the UITableViewDelegate and implement the method

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 

This solve your issue? If it is not solving your issue, try to explain better your goal, with examples/images.