UIWebview中的Highlite选择文本 [英] Highlite Select Text in UIWebview

查看:32
本文介绍了UIWebview中的Highlite选择文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用手势和高亮文本选择文本.我已经在 UIwebview 中显示了 html 页面,但 uiwebview 没有触发触摸开始事件,我该怎么做.

i want to Select text using gesture and highlite that text.i had done display html page in UIwebview but uiwebview does not fire touch begin event, So how can i do.

1) 当用户选择文本时(即用户选择文本i Know uesr",那部分文本颜色应该改变.

1) when user select text (i.e user select text "i Know uesr" that part of text color should be change.

如果您对下面的查询有任何想法,请建议我..

if you have any idea below of the query,kindly suggest me..

谢谢

米兰

推荐答案

蛮力法

您可以通过继承 UIWindow 将触摸捕获为 Window 级别.然后,您可以手动定位发生触摸的视图,然后是视图中的位置.

You can trap the touches as the Window level by subclassing UIWindow. Then you can manually locate the view the touch occurred in and then the location in the view.

至于实际使用操作系统突出显示文本,我认为您可能需要在 webview 顶部放置一个透明的叠加视图,然后在那里绘制突出显示.

As to actually highlighting the text with the OS, I think you might have to put a transparent overlay view on top of the webview and then draw the highlight there.

您将无法在 web 视图中进行选择,因为一次触摸也会打开链接.您将不得不创建一个界面来区分链接触摸和选择触摸.

You're going to have trouble selecting in a webview because a single touch also opens links. You're going to have to create an interface that distinguishes between link touches and selection touches.

这篇关于UIWebview中的Highlite选择文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆