Get current font size from automatic UILabel reduction

I have a UILabel with a font size equal to 24.0. I set it up so that it can automatically increase the font size to 12.0. When I get the font from the tag, it says that it is 24.0, although this is not the size that it uses to actually display the text.

How can I get what font size it really uses?

Note. I do not ask how to draw text, the text is already displayed in UILabel.

+4
source share
1 answer

From what I know, you cannot get it directly, but you can use the sizeWithFont: minFontSize: actualFontSize: lineBreakMode: method to calculate it. But keep in mind that this method is deprecated in iOS 7, and Apple does not recommend using a variable font size for labels, as it does not provide a consistent user experience.

Hope that helps :)

+1
source

Source: https://habr.com/ru/post/1526643/


All Articles