I'm tryiing to display some text in my app where there might be some URL in the text. I want the URL to be highlighted as hyperlinks and clickable. Furthermore, when it is clicked, I want to supply a callback where I can perform custom action. Of course the URL should be passed back to my callback so I know what to do with it (say open it in an in-app browser etc).
This might sound complicated but basically all the IM apps in the appstore (over 30 of them) have this functionality where a user can send an IM containing a URL and the receiving end can click on it and open the page in an in-app browser.
How is this done? I just can't figure it out. If you have a solution, please provide sample code. Thank you.
BTW:
The answer is NOT A UIWebView (because it is very slow to render multiple instances of it).
The answer is also NOT A UITextView because although it is capable of parsing URL it cannot be set a custom callback on clicks. So it just ends up opening safari.
The answer is also NOT A TTStyledTextLabel because although it is capable of parsing URL and assigning a custom action to it, it needs to be pre-assigned in a URLMap. And obviously in this case we don't know what the URL is before hand. As far as I know you cannot assign ALL url to a custom action.
alt text http://img169.yfrog.com/img169/3373/picture1ufx.png