固定宽度和高度的 UILabel 是否需要调用 SizeThatFits

Is SizeThatFits call necessary for a fixed width and height UILabel

如果我将 UILabel 框架设置为固定宽度,行数设置为 1 并设置

lineBreakMode = NSLineBreakByTruncatingTail

我是否还需要调用 sizeThatFits 来重构 UILabel。

如果您设置固定高度和宽度限制,那么您的标签大小将不会改变。它将被固定为您的约束的常量。所以,sizeThatFits 在那种情况下没有任何意义!!