How does a UILabel's minimumScaleFactor work? How does a UILabel's minimumScaleFactor work? objective-c objective-c

How does a UILabel's minimumScaleFactor work?


You need to set the label.adjustsFontSizeToFitWidth = YES;


In addition to what the other answers say, if you put minSize/defaultSize (division) as the minimumScaleFactor, it will be the same as using the old minimumFontSize.

Ex, if you want the minimum font size to be 10 using default label size, you can do:

[label setMinimumScaleFactor:10.0/[UIFont labelFontSize]];

(Replace [UIFont labelFontSize] with your label's font size if it is not the default).

which would be the same as:[label setMinimumFontSize:10.0];


According to the documentation:

Use this property to specify the smallest multiplier for the current font size that yields an acceptable font size to use when displaying the label’s text. If you specify a value of 0 for this property, the current font size is used as the smallest font size.

So if default font size for your label is 10, you put 0.7f as a minimumScaleFactorand it should do the same thing as minimumFontSize did.