开发者

How to underline the text in the cell in iphone

I am new to iphone development. I have created grouped table and display the contents in the cell. Now i want to display underlined the text in the cell (simila开发者_开发百科r hyperlink) based on my requirements. How can i achieve this. I did some research but i cant get any idea, please help me out.

Thanks.


There is no simple way to underline text in iPhone OS 3.1 and earlier. You'll need to query the UILabel displaying your text to determine its position and draw the underline yourself.

If you are targeting only the iPad (iPhone OS 3.2 and later), then you can make use of Core Text and NSAttributedString.


I've created an UILabel subclass, which supports:

  • multiline text with various label bounds (text can be in the middle of label frame, or accurate size)
  • underline
  • strikeout
  • underline/strikeout line offset
  • text alignment
  • different font sizes

https://github.com/GuntisTreulands/UnderLineLabel

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜