gpt4 book ai didi

iphone - UITableView 单元格字体大小

转载 作者:行者123 更新时间:2023-12-03 19:05:12 26 4
gpt4 key购买 nike

如果一行中的文本长度超过其容纳范围,是否有办法使文本“自动”变小?

最佳答案

是的:

UILabel *myLabel = /* init the label */
myLabel.adjustsFontSizeToFitWidth = YES;

对于 iOS 7:

myLabel.minimumScaleFactor = 0.5;  // Float from 0 to 1; as a scale of init size.

对于 iOS 6 及更早版本:

myLabel.minimumFontSize = 10;  // Float value, in pixels (int value recom'd).

您可以在 Apple's UILabel docs 中阅读更多内容.

关于iphone - UITableView 单元格字体大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1441706/

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