Skip to content

Instantly share code, notes, and snippets.

@keehun
Last active February 15, 2019 17:42
Show Gist options
  • Select an option

  • Save keehun/5a02d17c6346a22129f62396b5ccae9c to your computer and use it in GitHub Desktop.

Select an option

Save keehun/5a02d17c6346a22129f62396b5ccae9c to your computer and use it in GitHub Desktop.
Practical Dynamic Type: Attributed Strings, Snippet 2
// ...
label.adjustsFontForContentSizeCategory = true
NotificationCenter.default.addObserver(self,
selector: #selector (uiContentSizeCategoryChanged),
name: .FontMetricsContentSizeCategoryDidChange,
object: nil)
// ...
// ...
// MARK: Event Handlers
/// Update the sizes of all contained fonts whenever the Dynamic Type size changes.
@objc func uiContentSizeCategoryChanged() {
/// Handle contentSizeCategoryDidChange, here.
}
// ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment