[英]Minimum Font Size deprecated on ios version 6.0
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". 我刚刚使用iOS 6.0升级到xcode 4.5,它突出显示了我的XIB文件中所有UILabel的警告“ios版本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 ) 更新:图片不再可用(位于https://skitch.com/hahmadi82/eyk51/cloud )
minimumFontSize
property of the UILabel
is deprecated from iOS 6.0 onwards. 从iOS 6.0开始,不推荐使用
UILabel
minimumFontSize
属性。
An Alternative to the minimumFontSize
is minimumScaleFactor
. minimumFontSize
的替代minimumFontSize
是minimumScaleFactor
。 If you assign minimumFontSize/defaultFontSize
to minimumScaleFactor
, it works in the same way as minimumFontSize. 如果将
minimumFontSize/defaultFontSize
分配给minimumScaleFactor
,则其工作方式与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 代码如下 - 例如,字体大小为30.0,如果您希望最小字体大小为12.0
YOURLABEL.font= [UIFont fontWithName:@"FONT_NAME" size:30.0];
[YOURLABEL setMinimumScaleFactor:12.0/[UIFont labelFontSize]];
使用minimumScaleFactor代替... 链接
Quick fix ...Here minimum font size to be 8.0 快速修复 ...此处最小字体大小为8.0
CGFloat size = textLabel.font.pointSize;// font size of label text
[textLabel setMinimumScaleFactor:8.0/size];
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
eg 因为每个人都知道
setMinimumFontSize
已被弃用,所以替换setMinimumFontSize
其他方法是setAdjustFontToFitWidth
,它接受BOOL
例如
[yourLabel setAdjustsFontSizeToFitWidth:YES];
//or
yourLabel.adjustsFontSizeToFitWidth = YES;
I had similar problem. 我有类似的问题。 Quick fix is to use MinimumScaleFactor property of UILabel.
快速修复是使用UILabel的MinimumScaleFactor属性。
For Swift use the following: 对于Swift,请使用以下内容:
//set the number (ex. 8 to your desired minimum font size)
myLabel!.minimumScaleFactor = 8/myLabel!.font.pointSize;`
Works like a charm! 奇迹般有效!
Go into finder and find the .storyboard
file or your .xib
and open with TextEdit. 进入取景器并找到
.storyboard
文件或您.xib
并打开文本编辑。 Use find to locate the string "autoshrinkMode"
and replace the value "minimumFontSize"
to "minimumFontScale"
使用find找到字符串
"autoshrinkMode"
并将值"minimumFontSize"
替换为"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. 也可以在上面的评论中将@Rob归功于说明相同的答案。 He should receive credit for this one.
他应该获得这个奖励。
You can use minimum scale factor over there or drag a lable and set autoshrik-> minimum font. 您可以在那里使用最小比例因子或拖动标签并设置autoshrik->最小字体。
Maybe this can help you. 也许这可以帮到你。
Yes minumumFontSize
is deprecated. 是的,
minumumFontSize
已弃用。
Use following minimumScaleFactor:
- 使用以下
minimumScaleFactor:
-
Obj.minimumScaleFactor= (floatValue);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.