如何用顶部的文本框制作键盘? [英] How to make keyboard with textfield on the top of it?

查看:66
本文介绍了如何用顶部的文本框制作键盘?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在屏幕底部固定文本字段(可能带有按钮),并且在开始编辑时,我希望它(可能还有整个视图)随着键盘向上移动-就像在本机Messages应用程序中一样(或Whatsapp等...).有什么建议吗?

I need to have textfield (maybe with button) fixed at the bottom of screen, and when start editing, I want it (and probably the whole view) to move with keyboard up - just like in the native Messages application (or Whatsapp, etc...). Any suggestions ?

推荐答案

最简单的方法是将所有内容放入UIScrollView中,当使用UIKeyboardDidShowNotification显示键盘时,可以将其调整大小.然后滚动以确保您的视图可见.

The easiest way is to put everything in a UIScrollView, which you resize when the keyboard is shown using the UIKeyboardDidShowNotification. Then you scroll to ensure that your views are visible.

查看 Apple文档移动位于键盘下方的内容"下的

Check out the Apple documentation under "Moving Content That Is Located Under the Keyboard"

这篇关于如何用顶部的文本框制作键盘?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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