2

Possible Duplicate:
underline text in UIlabel

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

Community
  • 1
  • 1
iPhonegal
  • 43
  • 1
  • 1
  • 4

2 Answers2

0

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.

Lily Ballard
  • 182,031
  • 33
  • 381
  • 347
0

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

- (void)drawRect:(CGRect)rect {
   // Do underlined drawing here...
}
Erik
  • 5,791
  • 5
  • 30
  • 45