我正在以编程方式实例化 UILabel。标签显示倒计时的数字。问题是我似乎无法增加字体大小争议事实上我有以下代码
[self.viewAnimation addSubview:lblCounter];
[lblCounter setAdjustsFontSizeToFitWidth:NO];
[lblCounter setMinimumFontSize:30.0];
[lblCounter setTextAlignment:UITextAlignmentCenter];
UILabel 足够大,可以容纳 30 号字体。
有人有类似的问题吗?
最佳答案
使用[lblCounter setFont:[UIFont systemFontOfSize:30]]
, 最小字体大小仅在 adjustsFontSizeToFitWidth 为 YES 时适用,并规定在裁剪发生之前字体将缩小多少。
关于objective-c - 无法更改 UILabel 中的字体大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10812568/