I have a text view, which has links to web pages, like Wikipedia. Usually when I click on the links it closes my app and opens up Safari.
How do I control the hyperlink, so it loads the web page in the UIWebView instead of Safari?
Putting a button over the link isn’t what I want, because it is a scrollable text view.
Is there a Void I can call, because I also need to start showing the web view when the link is clicked.
Thanks. Any answers would be appreciated.
(I am a 12 year old learning to program for the iPhone. See Spaceulator or visit timh.me.uk for my first app)
You can register your app as a URL handler for some URL scheme – for example “nttp”.
Add the next lines in your Info.plist file:
When you write the content for your text view use the “nttp” URL scheme instead of the “http” (“nttp://www.stackoverflow.com/” instead of “http://www.stackoverflow.com/“).
Implement the application:handleOpenURL: method in your app delegate:
For example, you can replace the “nttp” by “http” and initiate some web view with it…
Hope that this solution is good enough…