Hide the virtual keyboard Methods
Using a virtual keyboard to input information is one of the most important interaction methods for iOS. A virtual keyboard usually appears automatically in an editable UITextField or UITextView editing event. It is easy to call a keyboard, but it is not that simple to collect it. In the previous article about how to collapse the keyboard after UITextField input, we introduced how to collapse the virtual keyboard after editing, however, if your components do not have corresponding events that allow you to collapse the virtual keyboard, what should you do? The following uses a similar component UITextView as an example to introduce some common methods.
1. Click UIView outside the editing area)
This is a very intuitive method. when you no longer need a virtual keyboard, you just need to click the virtual keyboard and edit a place outside the area to collapse the keyboard, the following code is a built-in Touch event method function in UIView. For details, refer to the basic usage of Touch Panel, Touch screen, and pressure sensor.