现在的位置: 首页 > 综合 > 正文

在不知道第一响应者的情况下取消键盘方法

2017年12月08日 ⁄ 综合 ⁄ 共 315字 ⁄ 字号 评论关闭

很多的时候,我们需要取消键盘,但是又不知道键盘的第一响应者,那么怎么办呢,那么可以通过一下方法解决:

    [[UIApplication
sharedApplication] sendAction:@selector(resignFirstResponder)
to:nil
from:nil
forEvent:nil];

官方文档有说明:

The object to receive the action message. If target is nil,
the app sends the message to the first responder, from whence it progresses up the responder chain until it is handled.

抱歉!评论已关闭.