在UIWebView中操作后隐藏文本选择句柄 [英] Hide text selection handles after action in UIWebView
问题描述
我有几个自定义 UIMenuItems
,可以在 UIWebView
中进行选择。在对该选择运行动作后,我想隐藏选择句柄,就像 copy:
一样。
I have several custom UIMenuItems
that do things with a selection in a UIWebView
. After the action has been run on that selection I want to hide the selection handles just as copy:
does.
我已经尝试使用 window.getSelection()。removeAllRanges();
并且在 window.getSelection()
中工作不再返回任何内容,只是文本选择句柄保持可见。
I have tried using window.getSelection().removeAllRanges();
and that works in that window.getSelection()
no longer returns anything but the text selection handles stay visible.
有没有办法删除选择和句柄?
Is there a way to remove the selection and the handles with it?
编辑:我不需要它是 JS 解决方案,但我不能通过重新加载webview来解除状态。
I don't need it to be a JS solution but I can't loose the state by reloading the webview.
推荐答案
只需禁用并重新启用用户互动:
Just disable and re-enable the User Interaction:
myWebView.userInteractionEnabled = NO;
myWebView.userInteractionEnabled = YES;
这篇关于在UIWebView中操作后隐藏文本选择句柄的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!