0

我们只是将用户输入放入我们的游戏中,以便用户可以输入电子邮件地址等。整个游戏是 Gl,根本没有 iOS UI。EAGLView 不会改变方向,它始终是纵向的,但是游戏是横向的,我们通过相机变换来处理这个问题。

我们想调出 iOS 键盘并为文本输入覆盖一个 UITextView。UITextView 是 EAGLView 的子视图。显然,它和键盘以纵向显示,因为 EAGLView 是纵向的。

无需将 EAGLView 更改为横向,有什么方法可以强制 UITextView 和键盘以横向显示?

如果我确实将 EAGLView 的方向更改为横向以使其正常工作,是否会对性能产生影响?我已经读过好几次了,在默认纵向视图以外的任何地方定位 GL 视图都会对性能造成影响,尽管我找不到任何确凿的证据。

谢谢,

4

1 回答 1

3

We think we have come up with a solution for this. We are doing two things, one for the keyboard and the other for the UITextView.

For the keyboard we are setting the status bar orientation. The keyboard follows when set.

[UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationLandscapeRight;

And to get the UITextView to orient correctly we apply a transform to subviews of our EAGLView, which in this case is only the UITextView, as follows.

    CGAffineTransform aTransform = CGAffineTransformMakeRotation(M_PI / 2);
    [glView UpdateSubViewTransforms:aTransform];        

This literally adds a 90 degree rotation to the view.

This has been tested on iPad & iPhone 4 with iOS 4.3, and on iPhone 3G with iOS 3.13.

于 2011-03-31T22:32:17.857 回答