hanumanDev
hanumanDev

Reputation: 6614

Link from an HTML file to a view

I have an HTML file that's loaded from a UIWebView. I'm looking to do the opposite - link from the HTML file to a different view controller. How would one go about doing this?

the html file is a local file within the app.

thanks for any help.

Upvotes: 1

Views: 272

Answers (3)

Reefaq
Reefaq

Reputation: 762

try using three20 library

https://github.com/facebook/three20

there is a helpful class for this named TTStyledText which render html as well as custom links. just need to map the links with ur controller. Go through the samples in three20!

Upvotes: 1

Deepak Danduprolu
Deepak Danduprolu

Reputation: 44633

You can do this by adopting UIWebViewDelegate protocol and implement the webView:shouldStartLoadWithRequest:navigationType: method. Here you can capture all requests and selectively use them for your purpose.

Define links such as yourapp://yourviewcontroller/argument within the HTML page and parse them in the above mentioned delegate method and load the appropriate view controller.

Upvotes: 1

RyanJM
RyanJM

Reputation: 7068

Sorry for the short answer, but there are a lot of parts to this. Check out this link.

http://forums.macrumors.com/showthread.php?t=463491

It looks like you might have to register the url with Apple. I know that for the maps application its able to do urls like map://... and I've seen other apps do it too, I just don't know the exact process.


Update: looks like this exampe from Apple should help.

Upvotes: 0

Related Questions