Possible Duplicate:
underline text in UIlabel
I want to underline the UILabel
text as hyperlink
UILabel *myLabel = [[U开发者_如何学编程ILabel 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
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.
You'll have to subclass the UILabel and do the drawing in
- (void)drawRect:(CGRect)rect {
// Do underlined drawing here...
}
精彩评论