Skip to content

Instantly share code, notes, and snippets.

@jeffbailey
Last active January 1, 2016 11:59
Show Gist options
  • Save jeffbailey/8141224 to your computer and use it in GitHub Desktop.
Save jeffbailey/8141224 to your computer and use it in GitHub Desktop.
How to use custom fonts that respond to Dynamic Type size changes.
NSNoticationCenter *center = [NSNotificationCenter defaultCenter];
[center addObserver: self selector:@selector(dynamicTypeChanged:) name: UIContentSizeCategoryDidChangeNotification
object:nil];
- (void) dynamicTypeChanged:(NSNotification *) note {
UIApplication *app = [UIApplication sharedApplication];
NSString *category = app.preferredContentSizeCategory;
if ([category isEqual:UIContentSizeCategorySmall]) {
...
} else if ([category isEqual:UIContentSizeCategoryMedium]) {
...
} else if ([category isEqual:UIContentSizeCategoryLarge]) {
...
} else ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment