开发者

Programmatically remove selection in UIWebView

开发者 https://www.devze.com 2023-01-16 13:05 出处:网络
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:

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...

0

精彩评论

暂无评论...
验证码 换一张
取 消