Is there anyway to have a label wordwrap text as needed? I have the line breaks set to word wrap and the label is tall enough for two lines, but it appears that it will only wrap on line breaks. Do I have to add line breaks to make it wrap properly? I just want it to wrap if it can't fit it in horizontally.
+6
A:
if you set numberOfLines to 0 (and the label to word wrap), the label will automatically wrap and use as many of lines as needed.
If you're editing a UILabel in IB, you can enter multiple lines of text by pressing alt-return to get a line break - return will finish editing.
Kendall Helmstetter Gelner
2009-07-13 18:57:18
To clarify for noobs like myself, this would be: cell.textLabel.numberOfLines = 0; cell.textLabel.lineBreakMode = UILineBreakModeWordWrap;
bmoeskau
2010-01-31 23:06:55
That sounds correct.
Kendall Helmstetter Gelner
2010-02-01 05:19:48
"I have the line breaks set to word wrap ". This only wraps on actual line breaks, it won't automatically break once it is to long.
Codezy
2009-07-14 18:31:35