Question

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"

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top