---------------------- The interface writing method directly in the code without IB implementation --------------
Uitextview * _ textview;
Use the following two statements to close the simulated keyboard.
[_ Textviewbecomefirstresponder];
[_ Textviewresignfirstresponder];
Note that _ textview can only be of the uitextview type.
--------------------- Method implemented using interface builder ---------------
1. Add in the Controller. h file
-(Ibaction) backgroundtap :( ID) sender;
2. Add the following in the Controller. M file:
-(Ibaction) backgroundtap :( ID) sender
{
[Namefieldresignfirstresponder];
[Numberfieldresignfirstresponder];
}
3. Open the sib file and click the view icon. Then press command + 4 to modify the uiview
Uicontrol
4. Press command + 2 to bring up the connection checker, link file's owner with the touch down event, and select backgroundtop: function.