Search code examples
objective-cios6

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?


Solution

  • 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].