IOS makes the keyboard disappear
Some text input controls will pop up when waiting for input, you can set the Did End On Exit callback method of these controls to collapse the keyboard when you click the button in the done or return column On the soft keyboard.
However, sometimes the keyboard does not have the above buttons, or we want to enable the keyboard to be closed when we click the background of the App view, whether or not the keyboard is opened at that time.
One way is to drag a button to the View, make it the same size as the View, and set the callback for clicking this button.
But, we can also have a simpler method.
We know that UIView has no Action, but its sub-class UIControl has many, so we can change the View type from UIView to UIControl, in this way, we can get the desired touch event for free, so the first step is to change the View class to UIControl:
Vc23zsS8/izRodTxysK8/rsmwo%9zo8l3a + DQo8cD48aW1nIGFsdD0 = "Write picture description here" src = "http://www.bkjia.com/uploads/allimg/160226/04155C936-1.png" title = "\"/>
Finally, we completed the compilation of the callback method:
-(IBAction) bgTaped :( id) sender {[_ text resignFirstResponder];}
Through the above steps, we have completed the functions we want ;)