Dismissing the keyboard using firstResponder
-
27-09-2019 - |
Question
To dismiss the keyboard I use either one of the following:
[sender dismissFirstResponder]
[self dismissFirstResponder]
The problem is, I have a situation where the user selects a text field, and some other text field is the first responder with the keyboard showing. I want to dismiss the keyboard when this particular text field is selected. So neither of these will work to dismiss the keyboard.
How can I dismiss the keyboard if I don't know who is the first responder?
Solution
See this answer for how to find the current first responder.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow