aleksy.t
aleksy.t

Reputation: 277

How to change application's fonts from settings?

I know that from the settings one can change the size of the fonts appearing on his device, however I can't see this change in my app. Is there a way to enable that for my app as well? Do I have to set something in info.plist or write extra lines of code? I couldn't find the answer on this particular issue. Only custom fonts were proposed

Thx!

Upvotes: 1

Views: 78

Answers (1)

Tal Cohen
Tal Cohen

Reputation: 1457

To use Dynamic Type you will have to use one of the font styles: .headline, .subheadline, .body, .footnote, .caption1, caption2.

and then use:

label.font = UIFont.preferredFont(forTextStyle: .headline)
label.adjustsFontForContentSizeCategory = true

Check out Apple's documentation regarding Scaling Fonts Automatically.

Upvotes: 3

Related Questions