开发者

Hide text selection handles after action in UIWebView

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.

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?

Edit: I don't need it to开发者_JAVA技巧 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;


you can simply refresh the webview if your data is only text then no body can trace that webview is refreshed

use this code

[webview reload];

i have done this thing in my apps & its work great


[_webview becomeFirstResponder]; After your action.

You just need this. I always use this way.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜