字体名称打印 及添加自定义字体
NSArray *familyNames = [UIFont familyNames]; for( NSString *familyName in familyNames ){ printf( "Family: %s \r", [familyName UTF8String] ); NSArray *fontNames = [UIFont fontNamesForFamilyName:familyName]; for( NSString *fontName in fontNames ){ printf( "\tFont: %s \r", [fontName UTF8String] ); } }
添加自定义字体:
1.导入xxx.tff文件到项目文件夹
2.在plist添加UIAppFonts项,在该项的子项添加xxx.tff
3.build phases->copy bundle resources里添加xxx.tff