1

Hello!

How to get text (string) in my UILabel. What I mean? I set a text for my UILabel programmatically. But if my text very large the text don't fit to my label and UILabel cutting off this text.

How I can to check new text with a cutting symbol?

For example:

Source: 'Some Large Text'

Cutting text: 'Some Large T...' (need to get this string)

Thanks for response!

Matrosov Oleksandr
  • 25,505
  • 44
  • 151
  • 277

1 Answers1

1

You have to set the UILabels's property linebreakemode and number of lines:

label.numberOfLines       = 2;
label.lineBreakMode       = UILineBreakModeWordWrap;

aditionally you might need to set the frame correctly. cheers

pmk
  • 1,897
  • 2
  • 21
  • 34
  • or UILineBreakModeTailTruncation if you want "Some long text" to read as "Some long..." instead. – Luke Mar 05 '12 at 15:56
  • Ok, thanks for response, but I want to get the text with a label. for example if now I see text in label 'Some Large T...' and I output in NSLog(@"%@", label.text) I want to see that text (Some Large T...) not a Some Large Text – Matrosov Oleksandr Mar 05 '12 at 16:04
  • have a look at this http://stackoverflow.com/questions/4100421/uilabel-visible-part-of-text – pmk Mar 05 '12 at 16:10