开发者

Trouble with onscreen keyboard orientation in iPhone OpenGL ES application

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开发者_JAVA技巧 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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜