How can I make clickable links like the Twitter and Facebook app? [duplicate]
Asked Answered
P

2

6

Possible Duplicate:
How to make an expression clickable on iOS?

On Twitter and Facebook, usernames like @ and hashtags like # are clickable, and do something native within the app.

What is the best way to implement something like this? It would be nice if there was a drop in replacement for a UILabel for example.

Prestidigitation answered 21/6, 2011 at 17:39 Comment(1)
See here #5773291Prisage
C
6

The TTTAttributedLabel project on github is a drop-in replacement for UILabel that supports embedding links. https://github.com/mattt/TTTAttributedLabel

Covenantor answered 21/6, 2011 at 18:37 Comment(2)
This looks interesting. Would I be able to do my own handling when a link is clicked? For example, present a modal view controller?Prestidigitation
I believe you'll have to write and register your own URL handler so that your application can handle the click. You may wish to also take a look at the Three20 project (github.com/facebook/three20) as all of the view linkage is done via app-internal URLs.Covenantor
E
-1

I'm not sure what Twitter does, but the Facebook app uses a library called Three20 to achieve Rich Text UILabels. They have the ability to be formatted and have in-line hyperlinks. You should specifically look at TTStyledTextLabel.

Check it out: http://three20.info/

Educe answered 21/6, 2011 at 18:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.