Is there any method to tell a UITableView to not release cells when they become not visible?
I’m asking this because I have this problem:
I have an UITableView used as an “insert View”. Inside the cells I have many UITextViews. When I push the UITableView, I send “becomeFirstResponder” to the first cell, to start the view with the keyboard opened. This works correctly.
But, If I scroll down, when the first cell become not visible, the keyboard close itself.
Note: the UITextView associated is a property retain and it correctly remains allocated, simply the cell disappear and the UITextView seems to resign first responder.
I know that I can check when the UITextView comes back visible and send another becomeFirstResponder, but I’d like to know if I can reach my goal with the first request 🙂
Thank you
Regards
Fabio
Here some new informations I’ve found:
I saw that the Keyboard was closing only the first time. Example: The view was loaded with the UITextView as the firstResponder. Scrolling, the keyboard would close.
But, after tapping on the UITextView again, the keyboard would open again and then never close, even if scrolling again.
Looking for understanding the reason, I discovered this:
When the UITextView was resigning first responder, I saw that it was happening because the UITableView was searching for that particular cell calling the CellForRowAtIndexPath method.
But, After tapping again, the CellForRowAtIndexPath was called only for other cells, not the selected one. It seemed that, if the UITextView was setted as the first responder AFTER the UITableView setup, the cell was retained even if not visible.
Then, I tried to move the “becomefirstresponder” in the “viewDidAppear” (called AFTER the uitableview setup) and then, magically, the problem was solved 🙂
The cell is no more released if the UITextView inside is the first responder.
The only remaining problem was this: calling “becomeFirstResponder” in the viewDidApper cause a lag in the keyboard to show on the screen. To avoid this, I called becomeFirstResponder in viewDidLoad, then in viewDidAppear I resigned and called again becomeFirstResponder.
Hope this helps