键盘出现在iPad时如何移动视图? [英] how move view up when keyboard appears in iPad?

查看:103
本文介绍了键盘出现在iPad时如何移动视图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当iPad虚拟键盘出现时,它会覆盖我视图中的一些文本字段。有没有办法在键盘出现时向上移动ViewController?。

When the iPad virtual keyboard appears, it covers some of the textfields in my View. Is there a way to move the ViewController up when the keyboard appears?.

推荐答案

我的建议是将对象放在 UIScrollView ,然后当键盘出现时,您可以使用 scrollRectToVisible:

My suggestion is to place your objects on a UIScrollView, then when the keyboard appears, you can use scrollRectToVisible:.

[scroller scrollRectToVisible:frame animated:YES];

这篇关于键盘出现在iPad时如何移动视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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