gpt4 book ai didi

ios - 自动调整 UILabel

转载 作者:IT王子 更新时间:2023-10-29 05:29:11 24 4
gpt4 key购买 nike

有没有办法自动调整 UILabel 的大小?给定大小 40 x 40,文本字体大小将根据字符数进行调整。

最佳答案

您可以使用 adjustFontSizeToFitWidth 属性。所以像这样。

UILabel *myLabel = [[UILabel alloc] init];
[myLabel setAdjustsFontSizeToFitWidth:YES];

在 Interface Builder 中,标签属性屏幕上有一个复选框,允许您调整字体大小以适应标签。

关于ios - 自动调整 UILabel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3244264/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com