qxli
V2EX  ›  iOS

求助, webview 中怎么由 touch 事件中获得 text 文本啊

  •  
  •   qxli · Jan 8, 2016 · 3184 views
    This topic created in 3800 days ago, the information mentioned may be changed or developed.

    我有一个 webview ,我增加了一个 touch 手势,现在问题是怎么从 touch 事件里得到选中的文本,请教大家

    7 replies    2016-01-08 18:04:01 +08:00
    qxli
        1
    qxli  
    OP
       Jan 8, 2016
    没有人知道么,哭。。。。。。
    buydip
        2
    buydip  
       Jan 8, 2016
    JavaScript
    qxli
        3
    qxli  
    OP
       Jan 8, 2016
    @huoshanhui 可以简单说下方法么,非常感谢
    buydip
        4
    buydip  
       Jan 8, 2016
    @qxli 你能先说详细点你的问题,我有点不是很清楚那个 touch 是干嘛的。
    qxli
        5
    qxli  
    OP
       Jan 8, 2016
    @huoshanhui 我想实现的就是我想点击 webview 里的某个位置时可以获得那个位置的内容,所以我加了一个手势,就比如说我 webview 里是一篇文章,如果我点击上边的字我可以获得到他点的是什么字。。
    buydip
        6
    buydip  
       Jan 8, 2016
    @qxli 个人建议利用 JS 来获取那个字,然后回调 iOS 函数告诉你。
    qxli
        7
    qxli  
    OP
       Jan 8, 2016
    @huoshanhui 嗯,我试试看能不能实现吧,多谢
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   987 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 22:01 · PVG 06:01 · LAX 15:01 · JFK 18:01
    ♥ Do have faith in what you're doing.