TechThirsty
TechThirsty

Reputation: 169

UIlabel which can detect clickable text or urls

How to implement a UiLabel which can implement clickable text and urls, i need this to use in a twitter application

Upvotes: 2

Views: 2285

Answers (2)

tadejsv
tadejsv

Reputation: 2092

You mean a clickable UILabel that behaves like a UIButton?

Make a new class that is descendant of UILabel and enalbe the userInteractionEnabled to get touch events.

Upvotes: 1

willcodejavaforfood
willcodejavaforfood

Reputation: 44063

Try using a UIWebView and use the delegate to deal with clicks.

NSString *html = @"<html><head><body><a href="http://www.apple.com>Click me</a></html>";  
[webView loadHTMLString:html baseURL:nil];

You could also use a UIButton with no borders.

Upvotes: 2

Related Questions