Last Updated: February 25, 2016
·
488
· elkraneo

how to console UIFont family names

Sometime i struggle with uiappearance proxy and get continuous error when trying to use custom fonts. This snippet helps me to identify which name string use for 'fontWithName'

NSArray *familyNames = [UIFont familyNames];
for( NSString *familyName in familyNames ){
    printf( "Family: %s \n", [familyName UTF8String] );
    NSArray *fontNames = [UIFont fontNamesForFamilyName:familyName];
    for( NSString *fontName in fontNames ){
        printf( "\tFont: %s \n", [fontName UTF8String] );
    }
}