使用滑动手势关闭键盘(如在消息应用程序中) [英] Dismiss keyboard with swipe gesture (as in Message app)

查看:229
本文介绍了使用滑动手势关闭键盘(如在消息应用程序中)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当iPhone的消息应用程序上显示键盘时,如果用户从消息表视图开始向下滑动并继续进入键盘区域,键盘将开始关闭。如果他们在此过程中上下移动手指,键盘会随之移动。

When the keyboard is showing on the iPhone's Messages app, if the user begins a swipe down from the messages tableview and continues into the keyboard area, the keyboard will begin to dismiss. If they move their finger up and down during this process, the keyboard moves with it.

Apple是否使用私有API执行此操作,或者是否有办法控制键盘从(我推测)一个手势识别器?

Are Apple doing this with private APIs, or is there a way to control the keyboard like this from (I presume) a gesture recognizer?

推荐答案

我创建了一个提供所需功能的UIView类别:

I created a UIView category that provides the desired functionality:

https://github.com/danielamitay/DAKeyboardControl

编辑:
它确实已在应用程序商店中使用。

It has indeed been used on the app store.

这篇关于使用滑动手势关闭键盘(如在消息应用程序中)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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