使用滑动手势关闭键盘 [英] Dismiss keyboard with swipe gesture

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

问题描述

在Messages.app中,您可以通过滚动列表视图来关闭键盘。要清楚,它不仅仅是响应 scrollViewDidScroll 事件。向下滑动时,键盘会用手指跟踪。知道如何做到这一点?

In Messages.app you can dismiss the keyboard down by scrolling the list view. To be clear, it isn't simply responding to a scrollViewDidScroll event. The keyboard tracks with your finger as you swipe down. Any idea how this is done?

推荐答案

从iOS 7开始,你可以使用

Since iOS 7, you can use

scrollView.keyboardDismissMode = .Interactive

来自文件:


UIScrollViewKeyboardDismissModeInteractive

键盘跟随屏幕上的
拖动触摸,可以再次向上拉以取消
解雇。

The keyboard follows the dragging touch offscreen, and can be pulled upward again to cancel the dismiss.

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

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