Last active
October 10, 2018 20:57
-
-
Save Koze/46860386c93e44d9aba2 to your computer and use it in GitHub Desktop.
Dynamic Type for some UI components
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | |
// UINavigationBar title | |
[[UINavigationBar appearance] setTitleTextAttributes:@{NSFontAttributeName: [UIFont preferredFontForTextStyle:UIFontTextStyleHeadline]}]; | |
// UIBarButtonItem title | |
[[UIBarButtonItem appearance] setTitleTextAttributes:@{NSFontAttributeName: [UIFont preferredFontForTextStyle:UIFontTextStyleSubheadline]} | |
forState:UIControlStateNormal]; | |
// UITabBarItem title | |
[[UITabBarItem appearance] setTitleTextAttributes:@{NSFontAttributeName: [UIFont preferredFontForTextStyle:UIFontTextStyleCaption1]} | |
forState:UIControlStateNormal]; | |
// UISegmentedControl title | |
[[UISegmentedControl appearance] setTitleTextAttributes:@{NSFontAttributeName: [UIFont preferredFontForTextStyle:UIFontTextStyleBody]} | |
forState:UIControlStateNormal]; | |
// UISearchBar text and placeholder | |
[[UITextField appearanceWhenContainedIn:[UISearchBar class], nil] setFont:[UIFont preferredFontForTextStyle:UIFontTextStyleBody]]; | |
return YES; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment