How to search text in UIWebView Consists of number of pages and the text should be highlighted in iPhone? - iphone

I parsed epub file into UIWebView.I tried to add UISearchBar for to find text and to be highlighted. For this i added UIWebViewSearch.js file. In my UIWebView i have so many pages. If click on next the next page is displayed or click on previous page previous page ids displayed. For this how to search the text in UIWebView ,How the text will be selected?
If anyone knows please help me.
Thanks in advance...........

There are plenty of examples on the web of JavaScript search and highlight functionalities.
Here is an example.
Once you have working JavaScript to search for terms and highlight them in the web page, you will need to call your JS and pass it the text that was entered in the UISearchBar.
This can be achieved by using:
NSString *jsCall = [NSString stringWithFormat:#"searchAndHighlight('%#');", yourSearchText];
[webView stringByEvaluatingJavaScriptFromString:jsCall];
UIWebView Class Reference

Related

Search and FInd a word/Letter in a WebView

I have a Webview in which i display the html pages,there i have placed a search bar, Now I have to find a letter or a particular word that i type in the search bar, those letters or word should be highlighted with different color in the present html page.
Help me out
Thanks in Advance
you can search for those keyword inside your html document that you are showing on the webview .Now you can reload the webview with new html formed by replacing keyword string with <>keyword<> string .

Annotating text in UIWebView

I am writing a app that has a UIWebView that displays a HTML5 page. I want to annotate some text on the web page and save it in SQLite database. The annotated text must be changed to a specific color as a visual effect.
Any suggestions that how can I select and get the text back in Objective-C?
You have two choices:
Parse the HTML5 document by hand
Inject Javascript into the page and walk the document. See Search and highlight text in UIWebView

How to Searching String from PDF using iphone sdk?

I am trying to create a PDF Reader application allow user to search string from the PDF. The very simple idea for displaying the PDF in webView but I don't know whether I can perform search in the PDF displayed in UIWebView or not?
If this is possible then please provide me any good tutorial for this. If not then I am using CGPDFDocumentRef and other classes of CoreGraphics. I am done with displaying PDF on a UIView without having UIWebView. I am unable to Zoom yet but it is displaying. Now for searching I have used this tutorial. http://www.random-ideas.net/posts/42. I am able to search and getting a bool value for string is available or not. but I am not getting how to highlight search text in PDF.
Please help me if it is possible with any one, UIWebView or the way I am doing using CoreGraphics.
Thanks.

Best approach for adding non-web links to UITextView

I am creating a dictionary-style app that presents a tableview full of words, and when a word is selected, a UITextView is displayed that shows the definition of the word. What I would like to do is add a line that says "See also: synonym1, synonym2" where synonym1 and synonym2 are links that will take the user to the definition for the synonym that is touched.
What is the best way to add these dynamic links? Buttons? Somehow add a small UIWebView a UItable on the fly?
Thanks!
I would replace your UITextView with a UIWebView and use that contain your description text and your links. It's fairly trivial to generate HTML on the fly for something like that.
You could register a custom URL scheme for your app, or you could intercept links as they're clicked.
If your links are always grouped together there's no reason why you couldn't use a bunch of UIButtons inside a custom view, but then you'd have to handle layout and wrapping on your own. It seems a lot easier to do it in HTML.

Displaying a URL in a UITableViewCell in a different color from the rest of the text

I'm working through the Stanford iPhone programming course online. The Presence app assignment pulls Twitter and displays each one in a separate UITableViewCell.
Updates often include URL's and I'd like to know how to display just the URL text in blue, having it be tappable. I can parse the text for URL's with no problem, just no idea how to display the URL itself.
Any advice or suggestions would be greatly appreciated.
As said above a button would work, but in terms of the UI it would probably look more natural if you had a label.
Alternatively, you could fill the UITableViewCell with a UIWebView. The UIWebView would hold all the text and you should easily be able to set part of the text as a link (color blue) using html.
You'll have to add a UIButton (or something similar) to the cell, with the button title being the URL and the action opening the actual link.