I am having a problem that just showed up with OS 3.1.
If I click in a UITextField and have the keyboard come up, then rotate my phone to Landscape, the keyboard switches to landscape version of keyboard, which is good. But then if I rotate back to Portrait, I get two keyboards, one above the other!
I tried compiling in 3.0 and this problem doesn't happen in that version. Is anybody else getting this problem or know what might be causing it?
Anyone figured a solution to this?
I was having problems of UITableViewCells not drawing themselves correctly when rotating, solved it by sending a reloadData message, but this problem arose instead.
After spending a whole day on this, I finally figured it out. I needed to send resignFirstResponder to the textfields that were keeping the keyboard out, but it ONLY works if you do it before you call the resignFirstResponder inside shouldAutorotateToInterfaceOrientation, and call [self.tableView reloadData] inside didRotateFromInterfaceOrientation
Don't call either of these in willAnimateRotationToInterfaceOrientation. Don't know why exactly, but that's the way it is. I found this out after much trial-and-error. Hope it helps someone in the future.
After spending a whole day on this, I finally figured it out. I needed to send resignFirstResponder to the textfields that were keeping the keyboard out, but it ONLY works if you do it before you call the resignFirstResponder inside shouldAutorotateToInterfaceOrientation, and call [self.tableView reloadData] inside didRotateFromInterfaceOrientation
Don't call either of these in willAnimateRotationToInterfaceOrientation. Don't know why exactly, but that's the way it is. I found this out after much trial-and-error. Hope it helps someone in the future.
This is an excellent tip. It appears that there is a bug in 3.1.x that is causing this problem. iOS 4.0 appears to do the right thing.
If I had something to add is the following. If you resign the first responder and then become the first responder again, there is a visible transition as the keyboard disappears and reappears after the rotation.
To avoid this issue, I created a hidden textField.
Then did the following:
After spending a whole day on this, I finally figured it out. I needed to send resignFirstResponder to the textfields that were keeping the keyboard out, but it ONLY works if you do it before you call the resignFirstResponder inside shouldAutorotateToInterfaceOrientation, and call [self.tableView reloadData] inside didRotateFromInterfaceOrientation
Don't call either of these in willAnimateRotationToInterfaceOrientation. Don't know why exactly, but that's the way it is. I found this out after much trial-and-error. Hope it helps someone in the future.
My app (DVPRemote) supports iOS devices that run iOS Version 3.1.3 and higher. I was pulling out my hair trying to get code that works fine on a iOS 4.x that provides support for a landscape keyboard to work on iOS 3.1.3. I had multiple keyboards stacked on top of each other, stretched keyboards, partial keyboards, etc. Nothing seemed to work until I saw your post. By simply moving the resignFirstResponder to the shouldAutorotateToInterfaceOrientation rather than in the didRotate notification method where I previously had it, everything works now. Thank you!