How to dynamically resize UITableViewCell height

araid picture araid · Jun 18, 2010 · Viewed 56k times · Source

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 height as the user writes and the text starts a new line.

My question is: do I need to reload the whole table just to increase the height of a cell? Isn't there any other method?

I've been searching a lot, and previous answers and tutorials just talk about how to calculate text height, how to implement heightForRowAtIndexPath... things that I already know. My concern is that, to achieve what I want, I will have to calculate height and reload the table every time the user enters a new character, which I don't find very clean or efficient.

Thanks.

Answer

Andrey Zverev picture Andrey Zverev · Jan 14, 2011
[tableView beginUpdates];
[tableView endUpdates];