Exploring text styles

The first step in order to understand and take advantage of Dynamic Type is to learn what a text style is.

You are probably used to defining fonts by setting the font size and font family. This definition is really strict, in that you are setting fixed sizes via specific numeric values.

A text style is more likely to be intended as a semantic description that doesn't give any information about font size but describes the way the font is used within the text context. Now, you can choose between six different styles with quite self-explanatory names:

  • UIFontTextStyleTitle(1,2,3)
  • UIFontTextStyleHeadline
  • UIFontTextStyleSubheadline
  • UIFontTextStyleBody
  • UIFontTextStyleCallout
  • UIFontTextStyleFootnote
  • UIFontTextStyleCaption1
  • UIFontTextStyleCaption2 ...

Get Learning iOS UI Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.