I have a multiple UILabels
. When the device size changes the width and height of the labels changes, so I scale down the text so it fits inside the label. What I want to do is get the font size from one label, and set it as the font size of the other labels, so that everything fits inside the labels, but are also the same size.
This is my code for rescaling the text:
Name_Label.numberOfLines = 1
Name_Label.adjustsFontSizeToFitWidth = true
Name_Label.lineBreakMode = NSLineBreakMode.ByClipping
I can get the point size as other answers have suggested:
Year_Label.font.fontWithSize(Name_Label.font.pointSize)
But this does not work, and comments suggest that this does not return the font size. So how do I get the font size of a label that has just been scaled down, and use that to set the other labels font size?
UPDATE: When I print the following code the output is the same, however in the simulator the size is different.
Year_Label.font = Name_Label.font