Quote:
Originally Posted by zulfishah
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:
Code:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
[hiddenTextField becomeFirstResponder];
return YES;
}
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
[self.tableView reloadData];
[textViewBeingEdited becomeFirstResponder];
}