How to make "remove the keyboard" on the iPhone?

Can anyone tell me how to add a “cancel key” to the virtual keyboard of an iPhone?

+4
source share
2 answers

You can add an InputAccessoryView that will sit on top of the virtual keyboard (the height is adjustable, but the width will always be) the width of the keyboard.

If you open the Safari application, when you click in the text box you will see a panel above the keyboard, this is an example of InputAccessoryView

On this accessory you can add a button that, when pressed, will reset the first responder to all relevant fields of the current view. This will reject the keyboard, regardless of what is currently in focus.

+3
source

I doubt this is the right way to add a button to a standard keyboard. You must add a button to your view that "tells" your controller (via addTarget ...) to send a resignFirstResponder message to the text box or search bar that called up the keyboard

0
source

All Articles