2

I need to take keyboard input in my OpenGL ES application, so I just created a hidden UITextField and added it as a subview to the main window along with the view that presents my content. I use the UITextField to control the keyboard and it works fine in a single orientation.

I then changed my code to support all orientations by rotating the OpenGL content myself based on UIDeviceOrientation notifications. To rotate the keyboard, I overrode the shouldAutoRotateInterfaceOrientation method in the UITextField's controller and returned YES for all orientations. But I still see that the keyboard does not rotate according to the orientation.

Any clues?

1 Answer 1

0

I solved this issue by adding the UITextField to a second hidden window and adding that window to my main window as a sub view. Not sure if this is acceptable, but it seems to solves my problem.

Update: Since iOS 4.0 adding the hidden window as a subview to the keyWindow seems to break things. The application crashes if you send it to background, then foreground, then background and in the end foreground. So, just leave the hidden window hanging, it should still work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.