UILabel字体大小? [英] UILabel font size?

查看:163
本文介绍了UILabel字体大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  itemTitle.font = [ UIFont systemFontOfSize:25]; 

当我将数字25增加到更大的值时,似乎只在标签上添加了一个上边距,这样就会把文本向下压,这样文本就会在底部被截断或者完全溢出。

我有另一个UILabel在systemFontOfSize 25的地方,它是比itemTitle文本小得多。这是怎么回事?不是25应该是一个绝对值?



我很困惑如何以编程方式更改uilabels的字体大小。 >

检查您的标签没有设置为自动调整大小。在IB中,它被称为Autoshrink(Autoshrink),正好在字体设置旁边。以编程方式,它被称为 adjustsFontSizeToFitWidth


I can't seem to modify the font size of a UILabel with the following code:

itemTitle.font = [UIFont systemFontOfSize:25];

As i increase the number 25 to something greater, it seems to only add a top margin to the label, which consequently pushes the text down so much, so that the text gets cut off at the bottom or completely overflows.

i have another UILabel elsewhere with systemFontOfSize 25, and it's much smaller than the itemTitle text. What's going on? Isn't 25 supposed to be an absolute value?

i am so confused on how to programmatically change font size of uilabels.

解决方案

Check that your labels aren't set to automatically resize. In IB, it's called "Autoshrink" and is right beside the font setting. Programmatically, it's called adjustsFontSizeToFitWidth.

这篇关于UILabel字体大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆