我正在构建一个仅限 iPad 的应用程序。我需要使用带有一些标签的自定义字体,所以我将它们添加到我的项目中。它们出现在我的“复制捆绑资源”的应用程序目标中。我还将他们的名字添加到我的应用程序的 -Info.plist 文件中:
<key>UIAppFonts</key>
<array>
<string>font1.ttf</string>
<string>font2.ttf</string>
<string>font3.ttf</string>
<string>font4.ttf</string>
</array>
即便如此,当我尝试设置标签的字体时,它似乎只是使用默认值。我一直无法弄清楚如何克服这个问题。任何帮助将不胜感激。
编辑:
- (void)debug {
NSLog(@"fonts: %@", [UIFont familyNames]);
UIFont *f1 = [UIFont fontWithName:@"Helvetica" size:20];
UIFont *f2 = [UIFont fontWithName:@"font1" size:5];
NSLog(@"f1:%@ f2:%@", f1, f2);
}
和输出: http: //pastie.org/1323195