1

iPhone app. I have a simple view with UITextView as first responder. I resign first responder and pop to the previous controller but the keyboard stays. Textview doesn't even exist anymore but the keyboard is still visible.

The controller that I pop to is a tableview, no objects that can even assume first responder status. So the keyboard is just there obscuring half my table and there is not even a way to dismiss it. I have to navigate back to a view that has a text box or textview, select one and dismiss that in order to get rid of the keyboard.

How is this possible?

Dean Davids
  • 4,174
  • 2
  • 30
  • 44
  • Is there more that one text view or other object that could be first responder in the first view, or are you certain that the text view is the first responder? – Jumhyn Jul 13 '13 at 00:11
  • can you post your code? – Dhruvik Jul 13 '13 at 04:22
  • There is actually a lot more going on, I shouldn't have said it was simple. On rotate to landscape I hide all other subviews and fill the viewable area with the textview. On rotate back I resign first responder (the textview) and restore the hidden subviews. Somewhere in the animations things get out of order... sometimes. It only happens intermittently but after it happens once, it then does it every time after. It may work as expected for days then suddenly breaks. The most puzzling thing to me is how the keyboard does not get dismissed, after the view is destroyed and no responders exist. – Dean Davids Jul 13 '13 at 11:42

1 Answers1

2

On viewWillAppear just write

   [self.view endEditing:YES];
SAMIR RATHOD
  • 3,512
  • 1
  • 20
  • 45
  • I am going to try this. The fact that my problem is intermittent means I just have to use it for a while and see. I have thought I had it fixed several times when it worked fine for days, then grrr! Thanks, will let you know if works and accept your answer if so. – Dean Davids Jul 13 '13 at 11:45
  • I put it in viewWillDisappear for the view that is editing. We'll see. It has never happened on the simulator or with device connected and I have not been able to make it happen to establish what exactly causes it. Pure guess work debugging this one. – Dean Davids Jul 13 '13 at 12:54