Ios 版本6.0不推荐最小字体大小

我刚刚用 iOS 6.0升级到 xcode 4.5,它在我的 XIB 文件中的所有 UILabels 上突出显示了一个警告: “在 iOS 6.0版本上不推荐使用最小字体大小”。有人知道这指的是什么,以及如何修复它吗?

更新: 图像不再可用(在 https://skitch.com/hahmadi82/eyk51/cloud)

35923 次浏览

Go into finder and find the .storyboard file or your .xib and open with TextEdit. Use find to locate the string "autoshrinkMode" and replace the value "minimumFontSize" to "minimumFontScale"

Odd that the conversion wasn't written in the update scripts...

Also credit to @Rob in the comments above for stating the same answer. He should receive credit for this one.

I had similar problem. Quick fix is to use MinimumScaleFactor property of UILabel.

You can use minimum scale factor over there or drag a lable and set autoshrik-> minimum font.

Maybe this can help you.

Use minimumScaleFactor instead... Link

Yes minumumFontSize is deprecated.

Use following minimumScaleFactor:-

Obj.minimumScaleFactor= (floatValue);

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]];

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;

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];

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!