I have a UITableView with a whole bunch of custom UITableViewCells in it. Each of these UITableViewCells has a UITextView in them.
The problem I'm having, is that if the user touches a UITextView, that becomes the firstResponder and the keyboard pops up. If the user then scrolls down to a point where the UITableViewCell that the firstResponder is on is no longer on the screen, I can't get at the UITextView to dismiss it.
I've tried holding (and retaining) a reference to the UITextView, but as soon as it leaves the screen and I try to access it I get an EXC_BAD_ACCESS. This happens no matter how many times I retain it, so I suspect it may be having dealloc called directly on it (I'm not sure how the cell dequeueing system actually works).
The other weird thing is that if I scroll the UITextField off screen, the keyboard can still be used to write to it, and the text typed is visible when I scroll back to the UITextField.
Any help would be much appreciated.
You can save the indexPath of the cell that user is editing. Then when he scrolls test if that cell is in visible cells of the tableView. If not get the text field from that cell and dismiss the keyboard.