Skip to content

Instantly share code, notes, and snippets.

@radiovisual
Last active January 24, 2016 02:38
Show Gist options
  • Save radiovisual/58c411e6cb3932c0fbfa to your computer and use it in GitHub Desktop.
Save radiovisual/58c411e6cb3932c0fbfa to your computer and use it in GitHub Desktop.
Render all your iOS app font names into an NSString that can then be placed within an NSArray
// Create an NSString that can that be copied into an NSArray
// of all the font names available to your Objective-C App
NSMutableString *str = [[NSMutableString alloc] initWithString:@""];
for (NSString *family in [UIFont familyNames]) {
[str appendString:@"//"];
[str appendString:family];
[str appendString:@"\n"];
for (NSString *name in [UIFont fontNamesForFamilyName: family]) {
NSString *arrayStr = [NSString stringWithFormat:@" @\"%@\", ", name];
[str appendString:arrayStr];
[str appendString:@"\n"];
}
}
NSLog(@"%@", str);
@radiovisual
Copy link
Author

Example Output:

//Bodoni 72
@"BodoniSvtyTwoITCTT-Book", 
@"BodoniSvtyTwoITCTT-Bold", 
@"BodoniSvtyTwoITCTT-BookIta", 
//Verdana
@"Verdana-BoldItalic", 
@"Verdana-Italic", 
@"Verdana", 
@"Verdana-Bold"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment