【发布时间】:2016-03-13 07:22:25
【问题描述】:
我关注了这个tutorial,自定义字体显示在我的故事板上,但是当我执行我的应用程序(在模拟器或设备上)时,字体没有反映。谁能帮忙。 这就是我所做的:
1- downloaded a .ttf file and copied it to my project
2- added "Fonts Provided By Application" in info.plist and added a row having the name of my custom font.
3- opened storyboard and selected the UILabel i want to have a custom font for, and selected the font as custom then selected my font. the font was shown on the storyboard correctly.
我错过了什么吗?
【问题讨论】:
-
确保字体文件包含在您的目标中:单击它,然后转到文件检查器(窗口右侧面板中的第一个选项卡)并检查旁边是否有复选标记您在“目标会员”部分中的目标。
-
还要检查您是否在 Info.plist 中列出了文件名,而不是字体名。
-
如果你做 NSLog(@"%@", [UIFont familyNames]); 怎么办?您的字体系列名称是否显示在列表中?
-
复选标记没有被选中,所以我选择了它。这可能是因为我使用多种语言。打印 NSLog 时,我看不到字体名称
-
选中复选标记后,请执行 Clean,然后再次运行应用程序,看看它是否现在打印 familyName(不是字体名称!)