旋转后以编程方式更改UIkeyboard的框架 [英] Programmatically change frame of the UIkeyboard after rotation

查看:52
本文介绍了旋转后以编程方式更改UIkeyboard的框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于我具有复杂的视图层次结构,因此我可以使用CGAffineTransformMakeRotation手动处理旋转.

Since i have a complex hierarchy of views i handle the rotation manually with CGAffineTransformMakeRotation.

一切都以和谐的方式旋转,状态栏,导航栏等等.唯一的问题是,如果键盘在旋转之前位于屏幕上,它会获得饱和状态条的方向,但是尺寸不合适.

Everything rotates in harmony, status bars, navigation bar etc. The only problem is, if the keyboard was on screen before rotation, it gets the orientation of the satiates bar but its size is not right.

如何强制其填充整个宽度并获得合适的高度?

How can i force it to fill the entire width and get the right height?

我使用单个测试UIview进行了测试,看起来像这样. http://dl.dropbox.com/u/15251533/iPhoneSimulatorScreenshot_20120430_133558.png

I tested with a single test UIview and it looks likes this. http://dl.dropbox.com/u/15251533/iPhoneSimulatorScreenshot_20120430_133558.png

推荐答案

我找到了一种摆脱这种情况的简单方法.如果在Textfield上调用resignFirstResponder,然后成为firstresdonder.旋转后键盘会显示在正确的位置.如果有键盘,它也不会干扰动画.

I found a simple approach to get rid of this situation. If you call resignFirstResponder on the Textfield and afterwards becomefirstresdonder consequently.The keyboard appears in the right position after rotation.It also does not disturb the animation if you have one.

这篇关于旋转后以编程方式更改UIkeyboard的框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆