underline text in UIlabel

Posted by semix on Stack Overflow See other posts from Stack Overflow or by semix
Published on 2010-04-26T05:33:18Z Indexed on 2010/04/26 5:43 UTC
Read the original article Hit count: 677

Filed under:
|
|
|

How to underline a text that could be multiple lines of string? I find some people suggest UIWebView, but it is obviously too heave a class for just text rendering.

My thoughts was to figure out the start point and length of each string in each line. And draw a line under it accordingly.

I meet problems at how to figure out the length and start point forthe string. Can anybody help me on this?

I try to use UILable::textRectForBounds, this should be the drawing bounding rect for the text right? Then I have to work on the aligment ? How can I get the start point of each line when it is center-justified and right justfied?

I am new here, so thank in advance.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about uilabel