I would like my app to support dynamic font sizes and I'm wondering what's the UIFont
textstyle
of this big "Welcome to Videos" title here:
This is what I'm currently using but it's way too small:
titleLabel.font = UIFont.preferredFont(forTextStyle: .headline)
title1
isn't working either. What is Apple using?
headline
used to be the largest UIFont.TextStyle
(ex. older guides).
Now, largeTitle
is the largest and better matches your screenshot:
label.font = UIFont.preferredFont(forTextStyle: .largeTitle)
To match even further, you'll want a version of that font with the bold trait. With [this extension], you can do:
label.font = UIFont.preferredFont(forTextStyle: .largeTitle).bold()
Which results in:
Also see https://www.iosfontsizes.com/:
.largeTitle 34.0 SFUIDisplay
.title1 28.0 SFUIDisplay (-Light ≤ iOS 10)
.title2 22.0 SFUIDisplay
.title3 20.0 SFUIDisplay
.headline 17.0 SFUIText-Semibold
.subheadline 15.0 SFUIText
.body 17.0 SFUIText
.callout 16.0 SFUIText
.footnote 13.0 SFUIText
.caption1 12.0 SFUIText
.caption2 11.0 SFUIText