Minimum Font Size deprecated on ios version 6.0
Solution 1
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]];
Solution 2
Use minimumScaleFactor instead... Link
Solution 3
Quick fix...Here minimum font size to be 8.0
CGFloat size = textLabel.font.pointSize;// font size of label text
[textLabel setMinimumScaleFactor:8.0/size];
Solution 4
I am answering very late, but might help any other.
As every one knows that setMinimumFontSize
has been deprecated, so other method replacing setMinimumFontSize
is setAdjustFontToFitWidth
which takes BOOL
e.g
[yourLabel setAdjustsFontSizeToFitWidth:YES];
//or
yourLabel.adjustsFontSizeToFitWidth = YES;
Solution 5
For Swift use the following:
//set the number (ex. 8 to your desired minimum font size)
myLabel!.minimumScaleFactor = 8/myLabel!.font.pointSize;`
Works like a charm!
![Hooman Ahmadi](https://i.stack.imgur.com/fWBsA.jpg?s=256&g=1)
Hooman Ahmadi
Updated on July 14, 2020Comments
-
Hooman Ahmadi almost 4 years
I just upgraded to xcode 4.5 with iOS 6.0 and it's highlighting a warning on all the UILabels in my XIB files saying "minimum font size deprecated on ios version 6.0". Does anyone know what this is referring to and how to fix it?
Update: image is no more available (was at https://skitch.com/hahmadi82/eyk51/cloud)