iOS自定义字体无效问题
加入了一个字体发现无效
最主要的原因是引用的时候fontwithname用的时文件名,而不是字体的Family name
要使用字体的Family name,而不是字体的文件名,弄错了将无法看到效果。
NSArray *familyNames =[[NSArray alloc]initWithArray:[UIFont familyNames]];
NSArray *fontNames;
NSInteger indFamily, indFont;
NSLog(@"[familyNames count]===%d",[familyNames count]);
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]);
}
[fontNames release];
}
[familyNames release];