Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
jrasmusson authored Jun 4, 2020
1 parent 53e6518 commit 9b733b6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions basics/DynamicFont/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

The way Apple keeps its fonts looking good (even when people resize their devices for accessibility) is through Dynamic Font - `UIFontTextStyle`.

Simply use a preferred font, and set `adjustsFontForContentSizeCategory = true` and you will never have to adjust your font size again. iOS will do it for you.

```swift
label.font = UIFont.preferredFont(forTextStyle: .body)
label.adjustsFontForContentSizeCategory = true
```


<img src="https://github.com/jrasmusson/ios-starter-kit/blob/master/basics/DynamicFont/images/preferred-font-sizes.png" alt="drawing" width="400"/>

<img src="https://github.com/jrasmusson/ios-starter-kit/blob/master/basics/DynamicFont/images/sizes.png" alt="drawing" width="800"/>
Expand Down

0 comments on commit 9b733b6

Please sign in to comment.