I have a TextView inside a UITableViewCell. The text inside the TextView can be edited right there in place.
The TextView grows and shrinks vertically depending on the number of lines the text contains. So far I haven't found a possibility to also let the row containing the TextView grow and shrink dynamically.
[tableView reloadData];
or
[tableView reloadRowsAtIndexPaths: withRowAnimation:];
don't work, because they dismiss the keyboard on every change.
Is there a way to change height of an individual row in a UITableView without dismissing keyboard?
Yes, you can have the row heights adjust as you type. It's not documented, and it defies reason, but all you need to do is set the new value in tableView.rowHeight (or have heightForRowAtIndexPath:ready to compute the new heights), then do this:
[tableView beginUpdates]; // updates the row heights ...
[tableView endUpdates]; // ... nothing needed in between
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With