Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

How to open UITextView link in custom UIViewController

Hello How can one open a link from UITextView in another UIViewController instead of the default behaviour (opening via safari). What am trying to achieve is the same approach twitter app uses when one clicks on a link. Any help will be appreciated.

5 Answers

Are you opening the link in a UIWebView?

Could just create your own "web browser" in app.

Yes I would like to listen to that link click then push that to another view controller which has webview to display the content of that link.. Same like the twitter app. How can I listen to link click from uitextview ?

This Stack Overflow answer seems to be basic enough. I am not sure where you are getting the link from. But like SO says you could just change the color of the text and make it a custom button instead - if it is always going to be a link.

Am fetching remote data and some comes with link.

Hmm... can you check what is coming back through and if statement and change things accordingly?

Are you asking about checking remote data? Am actually reading blog content

I was just talking it out. This is the opposite of what you want. But it should help.