views:

1102

answers:

1

How to let a label show multi-line strings?

e.g. The given string is @"HelloA\nHelloB\nHelloC\n".

How to show it like:

@"HelloA"

@"HelloB"

@"HelloC"

+2  A: 

I find some properties to customize UILabel:

label.numberOfLines = 3;
label.adjustsFontSizetoFitWidth = YES;
label.minimumFontSize = 8.0f;

And '\n' can be used as tail truncation mark.

iPhoney
adjustsFontSizeToWidth works only with numberOfLines = 1
Thomas
Thanks for your correction.
iPhoney