UIWebView Search

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

+4
source share
1 answer

I think it's best to continue:

  • Create a javascript function that will find your text.
  • Use stringByEvaluatingJavaScriptFromString: (see here) to get javascript code
  • Call the same method to search for the javascript function (put this code in a function that takes aString argument):

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

  • Put all this code in a function (e.g. findAString ), then call it from an UIWebView instance:
    [aWebView findAString: @ "foobar"];

+9
source

Source: https://habr.com/ru/post/1342302/


All Articles