qxli
V2EX  ›  iOS

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

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

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

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