如何检测iPad用户点击键盘隐藏按钮? [英] How to detect iPad user tap on keyboard hide button?

查看:300
本文介绍了如何检测iPad用户点击键盘隐藏按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我有一些围绕隐藏和显示键盘的复杂逻辑。我有兴趣检测用户(谁拥有iPad)专门点击iPad键盘上的隐藏按钮:

In my app I have some complex logic surrounding the hiding and showing of the keyboard. I am interested in detecting when the user (who has an iPad) specifically taps on the iPad keyboard hide button:

对检测键盘何时应该感兴趣隐藏,仅当用户实际物理上点击此按钮时。有什么建议吗?

I am not interested in detecting when the keyboard is supposed to hide, only when the user actually physically taps on this button. Any suggestions?

谢谢!

推荐答案

我在寻找一个完全相同的解决方案,我确实在文档中找到了它。你得到一整套键盘通知:

I was looking for an exact same solution, and I did found it in the documentation after all. You get a whole package of keyboard notifications:

- UIKeyboardWillShowNotification
- UIKeyboardDidShowNotification
- UIKeyboardWillHideNotification
- UIKeyboardDidHideNotification
- UIKeyboardWillChangeFrameNotification
- UIKeyboardDidChangeFrameNotification

我对UIKeyboardWillHideNotification感兴趣。所以刚刚实现:

I was interested in "UIKeyboardWillHideNotification". So just implemented:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(KeyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];

Etvoilà!希望这会有所帮助,即使这是一年的迟到答案。

Et voilà! Hope this helps, even it's an year late answer.

这篇关于如何检测iPad用户点击键盘隐藏按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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