Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set a custom keyboard for UIWebView

How to show a custom keyboard and Input Accessory View for a editable UIWebView for iOS7 and up.

i.e: How can i set and make use a value from [UIWebView setInputView:] and [UIWebView setInputAccessoryView:]

like image 224
Sathya Avatar asked Nov 06 '14 13:11

Sathya


1 Answers

It would be helpful to understand what you're trying to do? You can either be trying to force a specific type of keyboard such as numeric, email, etc. that will use the keyboard the user has explicitly installed on their device (or the system one).

In order to do this, you can reference this apple doc which shows you the 'type' attribute to add to an tag.

Otherwise you are asking about loading a custom keyboard that you have created from the webview. The app developer in me screams, "you should NEVER do this." If you're content is generic enough to merit putting into a webview, than it is certainly not worth loading a custom keyboard.

If you realllly need to do this, you can set keyboardDisplayRequiresUserAction to NO, then use custom javascript to request the app to perform a native function, then drop a uitextfield or uitextview directly overtop the html input field and set a custom input view on the native control. There are an obscene amount of problems with following this approach, and I sincerely hope you

like image 59
Todd Anderson Avatar answered Oct 11 '22 08:10

Todd Anderson