I have a label with a limited width, and I need it to automatically adjust the font size for the text. Since I need to underline the text, I assigned this label to the attribute:
[_commentsLabel setAttributedText:[[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"%d comments", [comments count]] attributes:@{NSUnderlineStyleAttributeName : @(NSUnderlineStyleSingle)}]];
As you can see, the number of comments will determine the length of the text. But for some reason the text is not shortened. The minimum font scale is set to 0.1 and the "Tighten the distance between letters" checkbox is selected.
I thought this might refer to the custom font that I use, but even with a standard system font, the text will be cropped.
source
share