agf119105 agf119105 - 1 year ago 83
Swift Question

How do I dismiss the keyboard in a custom keyboard?

I would like to assign a key/button on my custom keyboard to dismiss/hide the keyboard. I can't seem to get any code to work.

I have tried:



But nothing along these lines seems to work.

Could someone please point me in the right direction?

Answer Source

Call the dismissKeyboard() function.

Because a custom keyboard does not have access to the current text input object, you cannot send it a resignFirstResponder() message (as you would to dismiss the system keyboard when you are developing an app with text entry). To dismiss the custom keyboard, call dismissKeyboard() instead.

Apple reference.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download