1

I have several views in my Storyboard which have UILabels. These labels are set to Automatically Adjusts Font and use text styles like Body or Headline.

I know there is a programmatic approach as such: https://useyourloaf.com/blog/using-a-custom-font-with-dynamic-type/

let label = UILabel()
label.font = scaledFont.font(forTextStyle: textStyle)
label.adjustsFontForContentSizeCategory = true

However, given that I have already laid out my labels and set their text styles, is there a way to use a custom font AND text styles from within interface builder? Or maybe somehow override their font-family while respecting the text style already set on them?

1 Answer 1

1

No, you'd need to use the programmatic approach. However, it is easy to write a little loop that runs through all your labels and for each one, fetches the dynamic type "role" already set in interface builder and substitutes a UIFontMetrics value based on that "role" and the desired custom font.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.