How to dismiss keyboard on a UIWebView?

前端 未结 5 500
别那么骄傲
别那么骄傲 2021-01-31 21:05

I am loading an HTML page that has a form. I would like to be able to dismiss the keyboard when the user clicks on GO or if he clicks on the SUBMIT button on the HTML page.

5条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-31 21:46

    A more concise way without needing to know what element is selected is the following:

    [webView stringByEvaluatingJavaScriptFromString:@"document.activeElement.blur()"];
    

提交回复
热议问题