<tfoot id='eKEBw'></tfoot>

    <small id='eKEBw'></small><noframes id='eKEBw'>

      <bdo id='eKEBw'></bdo><ul id='eKEBw'></ul>
      <legend id='eKEBw'><style id='eKEBw'><dir id='eKEBw'><q id='eKEBw'></q></dir></style></legend>

      <i id='eKEBw'><tr id='eKEBw'><dt id='eKEBw'><q id='eKEBw'><span id='eKEBw'><b id='eKEBw'><form id='eKEBw'><ins id='eKEBw'></ins><ul id='eKEBw'></ul><sub id='eKEBw'></sub></form><legend id='eKEBw'></legend><bdo id='eKEBw'><pre id='eKEBw'><center id='eKEBw'></center></pre></bdo></b><th id='eKEBw'></th></span></q></dt></tr></i><div id='eKEBw'><tfoot id='eKEBw'></tfoot><dl id='eKEBw'><fieldset id='eKEBw'></fieldset></dl></div>

      iPhone 开发:在 UIWebView 上抓取选定/突出显示的文本

      时间:2023-10-22
        <tbody id='R5eMZ'></tbody>

      <small id='R5eMZ'></small><noframes id='R5eMZ'>

      • <tfoot id='R5eMZ'></tfoot>

          <bdo id='R5eMZ'></bdo><ul id='R5eMZ'></ul>

              1. <i id='R5eMZ'><tr id='R5eMZ'><dt id='R5eMZ'><q id='R5eMZ'><span id='R5eMZ'><b id='R5eMZ'><form id='R5eMZ'><ins id='R5eMZ'></ins><ul id='R5eMZ'></ul><sub id='R5eMZ'></sub></form><legend id='R5eMZ'></legend><bdo id='R5eMZ'><pre id='R5eMZ'><center id='R5eMZ'></center></pre></bdo></b><th id='R5eMZ'></th></span></q></dt></tr></i><div id='R5eMZ'><tfoot id='R5eMZ'></tfoot><dl id='R5eMZ'><fieldset id='R5eMZ'></fieldset></dl></div>
                <legend id='R5eMZ'><style id='R5eMZ'><dir id='R5eMZ'><q id='R5eMZ'></q></dir></style></legend>
                本文介绍了iPhone 开发:在 UIWebView 上抓取选定/突出显示的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                您好,

                请就我如何在 UIWebVIew 上获取所选文本提出建议.

                Please kindly advice on how possibly I can get the selected text on UIWebVIew.

                我继续搜索如何处理选定/突出显示的文本并发现以下内容:

                I went on to search on how to deal with selected/highlighted text and found the following:

                选择和菜单管理

                要在视图中复制或剪切某些内容,必须选择某物".它可以是一系列文本、图像、URL、颜色或任何其他数据的表示,包括自定义对象.实施自定义中的复制和粘贴行为视图,你必须管理的选择自己在那个视图中的对象.如果用户通过以下方式选择视图中的对象做出特定的触摸手势(例如例如,双击)您必须处理该事件,在内部记录选择(并取消选择任何以前的选择),也许在视觉上指出新的选择看法.如果用户可以在视图中选择多个对象对于复制剪切粘贴操作,您必须实现多重选择行为.

                To copy or cut something in a view, that "something" must be selected. It can be a range of text, an image, a URL, a color, or any other representation of data, including custom objects. To implement copy-and-paste behavior in your custom view, you must manage the selection of objects in that view yourself. If the user selects an object in the view by making a certain touch gesture (for example, a double-tap) you must handle that event, internally record the selection (and deselect any previous selection), and perhaps visually indicate the new selection in the view. If it is possible for users to select multiple objects in your view for copy-cut-paste operations, you must implement that multiple-selection behavior.

                这就是我迷路的地方....记录选择" - 我什至不确定如何表示选择,更不用说记录它了.

                And that's where I got lost. "...record the selection" - I'm not even sure how to represent a selection let alone recording it.

                非常感谢任何帮助.^^ 干杯!

                Any help is very much appreciated. ^^ Cheers!

                亲切的问候,呜呜呜

                推荐答案

                你可以使用stringByEvaulatingJavaScriptFromString 获取 UIWebView 中当前选定的文本.

                You can use stringByEvaulatingJavaScriptFromString to get the currently selected text in a UIWebView.

                NSString *selection = [self.webView stringByEvaluatingJavaScriptFromString:@"window.getSelection().toString()"];
                UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Selected Text" message:selection delegate:nil cancelButtonTitle:@"Okay" otherButtonTitles:nil];
                [alert show];
                [alert release], alert = nil;
                

                这篇关于iPhone 开发:在 UIWebView 上抓取选定/突出显示的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:访问 UIWebView 的 JavaScriptCore 引擎 下一篇:Xcode Instrument:内存术语 Live Bytes 和 Total Bytes (Real Memory)

                相关文章

              2. <legend id='9D8MX'><style id='9D8MX'><dir id='9D8MX'><q id='9D8MX'></q></dir></style></legend>

                <small id='9D8MX'></small><noframes id='9D8MX'>

                      <bdo id='9D8MX'></bdo><ul id='9D8MX'></ul>

                    <tfoot id='9D8MX'></tfoot>

                    <i id='9D8MX'><tr id='9D8MX'><dt id='9D8MX'><q id='9D8MX'><span id='9D8MX'><b id='9D8MX'><form id='9D8MX'><ins id='9D8MX'></ins><ul id='9D8MX'></ul><sub id='9D8MX'></sub></form><legend id='9D8MX'></legend><bdo id='9D8MX'><pre id='9D8MX'><center id='9D8MX'></center></pre></bdo></b><th id='9D8MX'></th></span></q></dt></tr></i><div id='9D8MX'><tfoot id='9D8MX'></tfoot><dl id='9D8MX'><fieldset id='9D8MX'></fieldset></dl></div>