How to change keyboard button “Return” to “Search” for input in a UIWebView?

痞子三分冷 提交于 2019-12-06 07:36:57

问题


I have this simple HTML file that is to be displayed in a UIWebView.

<html>
<body>
  <p>
  <input name='search' type='search' placeholder="Input type is search" />
</body>
</html>

Here is the screenshot when I clicked the input box.

How to change the Return button to 'Search' like Google page does?


回答1:


I found a simple solution. Just wrap the input with form tag so the HTML looks like this.

<html>
<body>
  <p>
  <form>
    <input name='search' type='search' placeholder="Input type is search" />
  </form>
</body>
</html>

And now the keyboard looks like




回答2:


Looking in the reference: Text Programming Guide for iOS and I can see that the type search isn't an option, so I think that Safari handle that with a different way. Maybe with a custom inputview. Take a look in my answer to do that.




回答3:


You have to select the textfield & in identity inspector you select search shown in pic below :



来源:https://stackoverflow.com/questions/20320696/how-to-change-keyboard-button-return-to-search-for-input-in-a-uiwebview

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