I'm basically trying to reproduce the core functionality of the "At Once" app. I have a camera view and another view with a text view on it.
I add both views to the window. All is well so far.
[window addSubview:imagePicker.view];
[window addSubview:textViewController.view];
I understand that the UIImagePickerController does not support autorotation, so I handle it manually by watching UIDeviceOrientationDidChangeNotifications and applying the necessary transforms to the textViewController.view.
Now, the problem here is the keyboard. If I do nothing, it just stays in portrait mode. I can get it to rotate by adding the following code to the notification handler.
[[UIApplication sharedApplication] setStatusBarOrientation:interfaceOrientation];
[textView resignFirstResponder];
[textView becomeFirstResponder];
However, the following simple test produces weird behavior.
- Start the app in portrait mode.
- Rotate the device 90 degrees clockwise.
- Rotate the device 90 degrees counterclockwise (back to the initial position).
- Rotate the device 90 degrees clockwise.
After step 4, instead of the landscape-mode keyboard, the portrait-style keyboard is shown, skewed to fit in the landscape keyboard frame.
Perhaps my approach is wrong from the start. I was wondering if anyone has been able to reliably make the keyboard change its orientation in response to setStatusBarOrientation.