Is there a w开发者_JS百科ay to programmatically remove the selection box of text which the user has selection in a UIWebView?
Just disable and re-enable the User Interaction:
myWebView.userInteractionEnabled = NO; myWebView.userInteractionEnabled = YES;
Try this,
For WKWebView
:
wkWebView.scrollView.subviews.first?.resignFirstResponder()
NSString * jsCallBack = @"window.getSelection().removeAllRanges();";
[webView stringByEvaluatingJavaScriptFromString:jsCallBack];
Sure... using JavaScript in the HTML document the UIWebView is displaying.
I suspect that's not what you mean by "programmatically", though...
精彩评论