当UITextField或UITextView出现键盘时调整界面 [英] Adjusting interface when keyboard appears for UITextField or UITextView

查看:55
本文介绍了当UITextField或UITextView出现键盘时调整界面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表格,每个单元格包含一个标签和一个文本字段。问题是,当我去编辑最后一行时,键盘隐藏表的下部,我不能看到正在键入的是什么。如何将我的界面移动到键盘上方,以便看到输入的内容?

I have a table with each cell containing a label and a text field. Problem is that when i go to edit the last row, keyboard hides the lower portion of the table, and i can't see what is being typed. How can i move my interface above the keyboard so i see what is being typed?

谢谢,
Mustafa

Thanks, Mustafa

推荐答案

您将要注册您的viewController UIKeyboardDidShowNotification UIKeyboardWillHideNotification 事件。当你得到这些,你应该调整你的表的边界;键盘是170像素的高度,所以只是收缩或增加你的表边界适当,它应该适当地调整到键盘。

You'll want to register your viewController for UIKeyboardDidShowNotification and UIKeyboardWillHideNotification events. When you get these, you should adjust the bounds of your table; the keyboard is 170 pixels height, so just shrink or grow your table bounds appropriately, and it should properly adjust to the keyboard.

这篇关于当UITextField或UITextView出现键盘时调整界面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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