Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS Storyboard - any way to change font size based on screen size?

I want to be able to scale the font size on a storyboard per screen size without writing code to do this, is this possible.

I already tried to set up constraints to adjust the label and set the font scaling factor but what happens then it depending on how long the text is I end up getting a screen that has different font sizes rather than all of the font for that screen being the same size?

like image 591
Michael Avatar asked Dec 16 '25 12:12

Michael


1 Answers

Xcode provides auto shrinks facility, Which adjust based on screen size Goto Attribute inspector-> Autoshrinks -> Minimum font scale set it to 0.5 or your desired value.

enter image description here

Programmatically

label.adjustsFontSizeToFitWidth = true
label.minimumScaleFactor = 0.5
like image 192
Jack Avatar answered Dec 19 '25 04:12

Jack



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!