Hide Input Keyboard on iPhone Without Knowing First Responder?

后端 未结 3 1693
不知归路
不知归路 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:53

    [textView isFirstResponder] should tell you if it's the first responder. I guess you could just loop through all text fields in your class to check if it's the first responder.

    Or you could just call resignFirstResponder on every textField, and it'll still work.

提交回复
热议问题