Last active
February 8, 2017 16:54
-
-
Save dornad/fe794cb2077077690b500ad599f849d7 to your computer and use it in GitHub Desktop.
iOS Find Font Names [Objective-C]
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
/////////////////////////////////////////////////////// | |
//prints out available fonts. | |
// from http://codewithchris.com/common-mistakes-with-adding-custom-fonts-to-your-ios-app/#uifont | |
//WARNING!!! YOU MUST FOLLOW ALL THE STEPS TO GET THE FONT TO WORK. | |
//1. Include the font in the project | |
//2. Make sure that they’re included in the target | |
// Check build phases and check the target membership(s)) | |
//3. Double check that your fonts are included as Resources in your bundle. check copy resources in build phases section. make sure font is selected | |
//4. add a "Fonts provided by application" info.plist entry with each font's full filename (no typos!) | |
//5. find the name of the font with this code: | |
NSArray *familiesSorted = [[UIFont familyNames] sortedArrayUsingSelector:@selector(compare:)]; | |
for (NSString* family in familiesSorted) { | |
NSLog(@"%@", family); | |
for (NSString *names in [UIFont fontNamesForFamilyName:family]) { | |
NSLog(@"== %@", names); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment