List available fonts in iOS
Here's an helper method to list available fonts inside an iOS app:
- (void)listAvailableFonts
{
NSArray *familyNames = [[NSArray alloc] initWithArray:[UIFont familyNames]];
NSArray *fontNames;
NSInteger indFamily, indFont;
for (indFamily=0; indFamily<[familyNames count]; ++indFamily)
{
NSLog(@"Family name: %@", [familyNames objectAtIndex:indFamily]);
fontNames = [[NSArray alloc] initWithArray:
[UIFont fontNamesForFamilyName:
[familyNames objectAtIndex:indFamily]]];
for (indFont=0; indFont<[fontNames count]; ++indFont)
{
NSLog(@" Font name: %@", [fontNames objectAtIndex:indFont]);
}
}
}
I usually use it inside didFinishLaunchingWithOptions:
.
Written by Junior B.
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ipad
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#