How to set a custom keyboard for UIWebView

偶尔善良 提交于 2019-12-06 23:57:57

问题


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:]


回答1:


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




回答2:


Are you trying to customize the ios keyboard or you want to show an HTML keyboard?

In the first case you can look at this link: link

In the second case you can just google for it, this is the first result searching for "html keyboard".

Good luck




回答3:


I believe there is no way to do this as of now. Hence, my current approach is to use a custom view below the keyboard and hide the keyboard and show the keyboard as required.



来源:https://stackoverflow.com/questions/26781122/how-to-set-a-custom-keyboard-for-uiwebview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!