I have a splitView Application that has a rootViewController and DetailsViewController When the application loads the detailsViewController pops a Modal viewController that contains a UINavigationBar.
The UINavigationBar has a search bar on it (set programatically). When focus is brought to the search bar the keyboard pops-up.
However, depending on the orientation of the device (simulator) the keyboard pops-up in the wrong orientation. The keyboard is always displayed as if the ipad is in a 'normal' orientation (i.e. at the side the home key is at)
I am returning YES in all of the shouldAutoRotate Methods:
- (BOOL)shouldAutorotateToInterfaceOrientation:
(UIInterfaceOrientation)interfaceOrientation;
To try and find out what was happening i added some debug code to each class to log the interfaceOrientation
each time the shouldAutorotate event is fired while also showing when the modal viewDidLoad
method fired. I did a test for each orientation: the debug output is shown below.
The debug shows that regardless of the actual device orientation, the rootViewController and DetailsViewController interface orientations are always Portrait.
The only correct logs (where interface orientation = device orientation) are the first and last(3rd) time the modal shouldAutorotate events are fired in each test.
If I rotate the iPad after the app has launched then the keyboard appears in the correct orientation.
Can anyone shed some light on why this might be happening and how to avoid it?
[PORTRAIT]
Home Button Position: bottom
Keyboard Appears: bottomDEBUG:
APP DELEGATE- ADD SPLITVIEWCONTROLLER
DETAIL-Interface Portrait
ROOT-Interface Portrait
ROOT-Interface Portrait
DETAIL-Interface Portrait
MODAL-Interface Portrait
MODAL DID LOAD
MODAL-ROTATE START
MODAL-ROTATE END
MODAL-Interface Portrait[LANDSCAPE]
Home Button Position: left
Keyboard Appears: leftDEBUG:
APP DELEGATE- ADD SPLITVIEWCONTROLLER
DETAIL-Interface Portrait
ROOT-Interface Portrait
ROOT-Interface Portrait
DETAIL-Interface Portrait
MODAL-Interface LANDSCAPE
MODAL DID LOAD
MODAL-ROTATE START
MODAL-ROTATE END
MODAL-Interface Portrait
MODAL-Interface LANDSCAPE[PORTRAIT]
Home Button Position: top
Keyboard Appears: topDEBUG:
APP DELEGATE- ADD SPLITVIEWCONTROLLER
DETAIL-Interface Portrait
ROOT-Interface Portrait
ROOT-Interface Portrait
DETAIL-Interface Portrait
MODAL-Interface Portrait
MODAL DID LOAD
MODAL-ROTATE START
MODAL-ROTATE END
MODAL-Interface Portrait
MODAL-Interface Portrait[LANDSCAPE]
Home Button Position: right
Keyboard Appears: rightDEBUG:
APP DELEGATE- ADD SPLITVIEWCONTROLLER
DETAIL-Interface Portrait
ROOT-Interface Portrait
ROOT-Interface Portrait
DETAIL-Interface Portrait
MODAL-Interface LANDSCAPE
MODAL DID LOAD
MODAL-ROTATE START
MODAL-ROTATE END
MODAL-Interface Portrait
MODAL-Interface LANDSCAPE