views:

720

answers:

1

I need to perform search in an html page displayed in a UIWebView control. The functionality I need is something that Safari has, when you hit command/ctrl F for searching the document for some word and the program highlights the hits for you. Is there any easy solution for this problem?

+3  A: 

You could do this with javascript. Check out the "Find in this page" bookmarklet: http://www.lifeclever.com/17-powerful-bookmarklets-for-your-iphone/

Something like that, combined with: http://developer.apple.com/iphone/library/documentation/uikit/reference/UIWebView_Class/Reference/Reference.html#//apple_ref/occ/instm/UIWebView/stringByEvaluatingJavaScriptFromString:

might do the trick.

agentj0n
Thank you for the answer. That what I figured out myself in the meantime, too. But the bookmarklet you have mentionded, doesn't works correctly, because it ruins the html if you search for something that can be found inside the html tag.I need to use something like that:http://james.padolsey.com/demos/misc/findAndReplace/
silicosaur