Pergunta

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 (similar 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.

Foi útil?

Solução

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.

Outras dicas

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

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top