I'm developing an iOS application with latest SDK and XCode 4.2.
I want to search a text in a UIWebview and scroll to the first text found.
I'm using this tutorial to find text: http://zaldzbugz.posterous.com/how-to-search-a-string-inside-uiwebview
How can I scroll to first text found?
Take a look at the last comment from tutorial you've used for highlighting. http://zaldzbugz.posterous.com/how-to-search-a-string-inside-uiwebview
Add this block of code into UIWebViewSearch.js after all manipulations with span
I've checked this solution on iPhone Simulator 4.3 and 5.0.
Let's go step by step.
Highlight
The code you used has the following snippet.
We need to a id to the span to move.So add id as follows,
Moving to the First occurrence.
Use the following javascript in 'Webview didload' to move to the first occurence.
Hope this is helpful.
You can scroll to the top most text found with this modification: