Changing title In UIWebview as user scrolls - cocoa-touch

I am developing an iOS app. How can I know the current section that is being displayed in the UIWebview and change the title of the navigation bar accordingly? The title will be the section which the user is reading. The sections in the html file displayed in the UIWebView are separated by <h2> tags.

If anyone is looking for an answer to this, this might help. Its basically done using javascript functions.

Related

UIWebView: how to hide part of the content of a webpage?

In my app I have a webview that is used solely for displaying the facebook page.
However, the client does not want the top blue bar of facebook to appear; he wants to hide it.
Is there a way to do this?
The bar is 45 pixels, so what I did is I moved the UIWebView in IB in such a way that its top 45 pixels are behind my navigation bar (thus not appearing).
However, this is not an ideal solution, as the user can see that content when he scrolls up, before bouncing. He can see but not touch it, which will be frustrating for some users.
I tried turning the bouncing off, but then the UI becomes too rigid, and not fluid.
I looked up in Google and Stackoverflow for a couple of hours but didn`t find a solution.
Thanks a lot!
You'll have to edit the HTML/CSS of the page itself to hide the HTML elements in question, probably using regular expressions, and feed it into your UIWebView with loadHTMLString:baseURL:.
I've done similar manipulating before and it works, but... it's a different ballgame when the webpages in question don't belong to you. Any time Facebook updates their layout, your app behavior might change until you have time to get an app update approved. Clients want what they want, but make sure your client knows what he's asking for!
First test out the javascript code used to hide whatever elements in the webpage and then pass up to stringByEvaluatingJavaScriptFromString of UIWebView to run it.

iOs multi page browser (safari) like view

I want to open multiple pages in my app just like iPhone( safari browser). Have two questions:
What is the best way to hold the views here, One view controller with an array of views to switch from ?
how to show safari like selection of views,where we can slide through a row or views and select one.
If you have any links or examples for this functionality pls share.
Thanks in advance.
There is a open source library that implement something that look like the mobile safari (iPhone) multiple page selection. It is not using some uiwebview in the sample, but I guess it can be adapted to use uiwebview : https://github.com/100grams/HGPageScrollView
I'm also working on a Mobile safari clone, it's not yet implementing multiple pages selection, but I plan to add this when I'll be able to find some time to work on this. You can check this project here : https://github.com/sylverb/CIALBrowser
look for uiscrollview uiwebview

App should open links with WebView not with Safari

I've got an UITextView in my app where rss feeds are loaded in. Now I want that when there's a link in the textview and you tab on it, my webview should open that link not safari. How can I do this?
Hey,
It will be difficult for you to know where you have clicked in your UITextView.
Honestly the best way for you to do that it to use the Three20 framework.
I don't think this is possible in a UITextView without significant effort.
Just an idea, but could you not load your RSS feed directly into a UIWebView? - (You can display a HTML formatted string in a UIWebView). Subsequent link presses could then by hijacked using the UIWebView delegate and handled by your application to (for example) open them in another UIWebView. Take a look at the UIWebView interface & delegate to see if it might help.
Hope this helps!
Nick.

custom scrollbar in UIWebView iphone

My UIWebView has a huge data to display and the default scrollbar that comes with UIWebview takes lot of time to scroll.
Is it possible to implement a scrollbar on which user can tap and drag that were he wants.
Any hint in the right direction would be highly appreciated.
Waiting for your reply.
Thanks in advance
It depends on the type of the contents you are displaying in UIWebview.
Did you try make use of Javascript calls to scroll to certain ids within your html page?
Take a look at the wikipedia application or Wikipanion for iPhone for example... They have navigation screen so the user can jump to the section of their interest without the need to scroll the whole page.
hope that will help.

Detecting text hilight in a UIWebView

I am using a UIWebView to display text on iPad. So far so good. Is there a way to detect when the user hilights text on a page, and override the default menu action so I can have the text do other things?
-Chris
Maybe you can find something usefull here: Override iPhone copy menu captions on a long-press?