In the development process, we have used many methods in order to achieve the purpose of clicking the keyboard in other places on the screen.
If you are collecting the keyboard in Uiviewcontroller, there are other methods besides calling the control's Resignfirstresponder method.
The first of these methods
Overload-(void) Touchesbegan: (Nsset<uitouch *> *) touches withevent: (Uievent *) Event method, then execute in this method [Self.view endediting : YES].
The code examples are as follows:
-(void) Touchesbegan: (Nsset<uitouch *> *) touches withevent: (uievent *) event{ [Self.view endediting:yes];}
If getting the current uiviewcontroll is difficult, you can use the second or third method. The effect can be achieved by directly executing one of the following two methods.
The second method of
[[UIApplication sharedapplication] sendaction: @selector (resignfirstresponder) To:nil From:nil Forevent:nil];
The third method of
[[[UIApplication sharedapplication] Keywindow] endediting:yes];
Several methods of ios-recovering keyboard