Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add clickable Links to UILabel with attributedText in iOS 6

I used DTCoreText to display formatted text in my apps. DTAttributedTextView also supports clickable links.
Since iOS6 we can use the setAttributedText function to display attributedStrings in UILabel.
But how can I display Links that are clickable? Is there a way to call a delegate Function etc. when a link is pressed?

like image 982
jtmayer Avatar asked Oct 30 '12 15:10

jtmayer


1 Answers

The iOS 6.0 UILabel still cant display clickable links.

However you could use a UITextView instead. The textview can detect links, but the link detection only work if editing of text is disabled. Limitations are that you cant do something like this in BBCode [url=www.apple.com]Apples Website[/url].

like image 102
Helge Becker Avatar answered Sep 30 '22 18:09

Helge Becker