在不知道第一响应者的情况下在iPhone上隐藏输入键盘? [英] Hide Input Keyboard on iPhone Without Knowing First Responder?

查看:82
本文介绍了在不知道第一响应者的情况下在iPhone上隐藏输入键盘?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我见过这个问题,但问题是是如何知道哪个textView是第一个响应者? 这个问题看起来很有希望第一个响应者,但事实证明它调用私有API。有没有办法隐藏键盘或找出第一个响应者作为一个谁有键盘?

I have seen this question, but the question is how to know which textView is the first responder? This question looked promising to figure out the first responder, but it turns out that it calls private APIs. Is there any way to hide the keyboard or to figure out the first responder as the-one-who-has-the-keyboard?

推荐答案

很容易:

[[[UIApplication sharedApplication] keyWindow] endEditing:YES];

看看 UIView类参考

这篇关于在不知道第一响应者的情况下在iPhone上隐藏输入键盘?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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