开发者

Programmatically remove selection in UIWebView

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜