开发者

UIWebView search [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
开发者_Go百科

Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.

Closed 6 years ago.

Improve this question

What is the best way to search for a string of text in a UIWebView?


I think that the best to proceed is to:

  1. Create a javascript function that will find your text
  2. Use the stringByEvaluatingJavaScriptFromString: (see here) method to get the javascript code
  3. Call the same method to look for the javascript function (put this code in a function that will take the aString argument):

    NSString *findThisStringFnc = [NSString stringWithFormat:@"findThisString('%@')",aString];
    [self stringByEvaluatingJavaScriptFromString:findThisStringFnc ];

  4. Put all this code in a function (findAString for example) then call it from the UIWebView instance:
    [aWebView findAString:@"foobar"];

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜