Hide Input Keyboard on iPhone Without Knowing First Responder?

后端 未结 3 1714
不知归路
不知归路 2021-01-04 19:30

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 tu

3条回答
  •  情歌与酒
    2021-01-04 19:48

    It's easy:

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

    take a look at UIView Class Reference.

提交回复
热议问题