tags:

views:

123

answers:

2

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

+1  A: 

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

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

You could also use a UIButton with no borders.

willcodejavaforfood
I have a table view in which the cell have text that contains multiple clickable data,so UIWebView wont help, i need a Uilabel.
TechThirsty
Not sure I understand why that would not work, care to enlighten me?
willcodejavaforfood
+1  A: 

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.

tadej5553
I have a table view in which the cell have text that contains multiple clickable data.
TechThirsty
Oh, in that case this is imposibile.Create a custom table view cell, that contains the custom UILabel subclass instead of UILabel. You would probabaly want to add a ivar like owner or something, so that the UILabel subclass would know who to send the touch message to.
tadej5553
nothing's impossible. see how he did it here http://www.three20.info/overview in the "style section"
iWasRobbed