ResignFirstResponder and close the keyboard from anywhere?

I have a situation where the keyboard can be opened, and then NSTimer pops up over the text view. Is there anyway to close the keyboard all over the world, and not from the resignFirstResponder view method? The reason I'm asking is because the textView is dynamic because sometimes it can be, rather than others. One way is to give him a TAG. Is it possible to refer to multiple elements using the same tag?

I think the answer is no, but would I be interested in your thoughts?

thank

Steve

+3
source share
4 answers

endEditing: UIView . UITextView, .

+5

, , Responder, :

[[[[UIApplication sharedApplication] delegate] window] endEditing:YES];
+7

You may try to send some control over the startFirstResponder message

0
source

You can pass a link to a UITextView in NSTimer ...

ORRRRR ....

In the view that appears, you can do something like:

for(id view in self.superview.subviews){
    [(UIView *)view resignFirstResponder];
}
0
source

Source: https://habr.com/ru/post/1790986/


All Articles