gpt4 book ai didi

iPhone UITableViewCellStyleValue1detailTextLabel重叠textLabel

转载 作者:行者123 更新时间:2023-12-03 21:12:39 25 4
gpt4 key购买 nike

我在表中使用 UITableViewCellStyleValue1 并为textLabel 和detailTextLabel 设置一些文本。在一个单元格中,详细文本标签是一个很长的 URL,它与 textLabel 重叠(通常是“URL”,然后缩写为“U.”),这很糟糕。除了创建自己的标签并将其放在默认标签所在的同一位置之外,是否有其他方法可以防止这种情况发生?

谢谢!

最佳答案

您需要设置 TextLabel 的最小字体大小。 UILabel Class Reference

adjustsFontSizeToFitWidth

A Boolean value indicating whether the font size should be reduced in order to fit the title string into the label’s bounding rectangle.

@property(nonatomic) BOOL adjustsFontSizeToFitWidth

Discussion

Normally, the label text is drawn with the font you specify in the font property. If this property is set to YES, however, and the text in the text property exceeds the label’s bounding rectangle, the receiver starts reducing the font size until the string fits or the minimum font size is reached.

The default value for this property is NO. If you change it to YES, you should also set an appropriate minimum font size by modifying the minimumFontSize property. Availability

* Available in iPhone OS 2.0 and later.

See Also

*   @property font
* @property minimumFontSize

关于iPhone UITableViewCellStyleValue1detailTextLabel重叠textLabel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2120163/

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