tags:

views:

76

answers:

3

Hi...

I want to underline the UIlabel text as hyperlink

UILabel *myLabel = [[UILabel alloc] initWithFrame:CGRectMake(20.0, 220.0, 160.0, 30.0)];

myLabel.text = @"click here";

how can i make the above string to be underlined..

Thanks for any help

A: 

Create a UIView with a height of 1 and a background color of black, and stick it below the label. Alternatively, you can use CoreText to render an attributed string with an underline, though that requires a bit more work.

Kevin Ballard
No, HTML is not supported.
Kevin Ballard
A: 

You'll have to subclass the UILabel and do the drawing in

- (void)drawRect:(CGRect)rect {
   // Do underlined drawing here...
}
Erik
can you pls provide me a sample..
iPhonegal
@iPhonegal click on my link - I posted full code there.
kovpas