Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试检查我的 UILabel 是否需要截断它的最后一行,并且实际上使用了“NSLineBreakByTruncatingTail”。我可以直观地看到带有尾部的截断,但我想创建一个关于是否需要“NSLineBreakByTruncatingTail”的条件。
这可能吗?
您可以boundingRectWithSize根据字体属性和文本计算大小,并将其与标签大小进行比较。
boundingRectWithSize