检测UIKeyBoard是否正在显示 [英] Detect if UIKeyBoard is Showing

查看:100
本文介绍了检测UIKeyBoard是否正在显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想检测键盘是否正在显示。我发现了一些其他帖子遍历UIWindow的子视图以找到键盘,但如果这是唯一的方法,那么我会找出其他的东西。我想我也可以观察UIKeyboard通知,但我猜测那里有更清洁的解决方案。

I'd like to detect whether or not the keyboard is showing. I've found a few other posts that traverse the subviews of UIWindow to find the keyboard, but if that is the only way then I'll figure out something else. I suppose I could also observe the UIKeyboard notifications, but I'm guessing there is a cleaner solution out there.

推荐答案

我是不确定观察UIKeyboard通知时脏是什么,但它绝对胜过遍历UIWindow层次结构。

I am not sure what's "dirty" in observing UIKeyboard notifications but it definitely beats traversing UIWindow hierarchy.

这篇关于检测UIKeyBoard是否正在显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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