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
It's easy:
[[[UIApplication sharedApplication] keyWindow] endEditing:YES];
take a look at UIView Class Reference.
I believe you should pick something to become the first responder, something which probably doesn't do anything on its own, and call -[UIResponder becomeFirstResponder]
on it. This would work well with a UIViewController or UIWindow (which you can get through -[UIView window]
, I think) because these would have the most similar responder chains, and would make the current firstResponder loose its firstResponder status, dismissing the keyboard, but also wouldn't bring up the keyboard, as it would not be a UITextField.
[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.