First of all, forgive me if the answer is already out there (I honestly have been working and searching for about two weeks).
And now, the situation:
I have a UITextView
as a subview of a UITableViewCell
in a UITableView
. The UITextView
is the first responder (while user is typing).
I have it set up (through delegate protocol methods) so that after each typed character, the cell's rowHeight
is recalculated (correctly and in the tableViews delegate protocol for rowHeight). So far everything is fine.
Then, I want that cell to be reloaded (or refreshed, whatever the term may be) without resigning its subview, UITextView
, as first responder.
A non-satisfactory solution around the problem:
I am able to use [tableView reloadData]
and then [textView becomeFirstResponder]
to simulate this (so that user doesn't even notice that the textView was reloaded) and the rowHeight is perfect, but this has been causing me a lot of problems (especially with making sure that the cursor does not jump to the end every time the user types a character and with autocorrect forcefully enforcing its suggestions due to textView resigning).
Is there a way to redraw or resize a UITableViewCell
(to dynamically change its rowHeight
) without causing any of its subviews to resign as first responder?
Using tableView's [tableView beginUpdates]
and [tableView endUpdates]
will solve this issue. See this answer for more information.
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