When I opened a existing project in xcode 7.2, I got a warning saying "minimum font size" is deprecated in ios 6.0.
I have changed it to minimum scale factor.
labelDescription.numberOfLines = 2;
//labelDescription.minimumFontSize=10;
labelDescription.minimumScaleFactor = 10;
Does changing the property to minimum scale factor produce the same effect as minimum font size?
Both are the same but the minimumFontSize
property of the UILabel
is deprecated from iOS 6.0 onwards.
An Alternative to the minimumFontSize
is minimumScaleFactor
. If you assign minimumFontSize/defaultFontSize
to minimumScaleFactor
, it works in the same way as minimumFontSize
.
The Code is as follows - For Example the font size is 30.0 and if you want the minimum font size to be 12.0
YOURLABEL.font= [UIFont fontWithName:@"FONT_NAME" size:30.0];
[YOURLABEL setMinimumScaleFactor:12.0/[UIFont labelFontSize]];
It produces the same effect, but you need to provide appropriate value for the minimum scale factor.
You should use values between x > 0 && x <= 1. This means if your font is 20, and your scale factor is 0.5, the minimum font size used for scaling will be 10.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With