开发者

How to underline the text in the cell in iphone

开发者 https://www.devze.com 2022-12-28 11:51 出处:网络
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

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

精彩评论

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