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!
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

kennedy otis
3,570 PointsHow 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

Patrick Donahue
9,523 PointsAre you opening the link in a UIWebView?
Could just create your own "web browser" in app.

kennedy otis
3,570 PointsYes 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 ?

Patrick Donahue
9,523 PointsThis 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.

kennedy otis
3,570 PointsAm fetching remote data and some comes with link.

Patrick Donahue
9,523 PointsHmm... can you check what is coming back through and if statement and change things accordingly?

kennedy otis
3,570 PointsAre you asking about checking remote data? Am actually reading blog content

Patrick Donahue
9,523 PointsI was just talking it out. This is the opposite of what you want. But it should help.