Custom font is not working in my App?(自定义字体在我的应用程序中不起作用?)
问题描述
在我的 iPhone 应用中,
In my iPhone app,
我已经包含了两种自定义字体,并通过stackoverflow问题引用了这个步骤......
I have included two custom fonts and by referring this steps by stackoverflow questions....
如何在 iPhone 中包含和使用新字体SDK?
并编码....
[lbl setFont:[UIFont fontWithName:@"glyphish.ttf" size:[lbl minimumFontSize]]];
我正在为 Base SDK 5.0 构建此应用
I am building this app for Base SDK 5.0
答案是,
[lbl setFont:[UIFont fontWithName:@"glyphish" size:[lbl minimumFontSize]]];
谢谢大家.
推荐答案
您传递了一个文件名 (glyphish.ttf) 而不是实际的字体名称.最有可能的是,字体名称是 Glyphish,但您需要以某种方式查询它:使用 Mac 的Font Book.app"或通过代码:首先,您需要通过 [UIFont familyNames].然后,使用 [UIFont fontNamesForFamilyName:] 获取要加载的实际字体名称.例如,如果您的字体包含粗体变体,其系列名称将是 Glyphish,但字体名称可能是 Glyphish-Bold.
You have passed a filename (glyphish.ttf) instead of the actual font name. Most likely, the font name is Glyphish, but you need to query it somehow: either using the Mac's "Font Book.app" or via code: first, you need to query the family names via [UIFont familyNames]. Then, use [UIFont fontNamesForFamilyName:] to get the actual font names to load. For example, if your font contains a bold variant its family name would be Glyphish but font name would likely be Glyphish-Bold.
这篇关于自定义字体在我的应用程序中不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:自定义字体在我的应用程序中不起作用?
基础教程推荐
- 新的@SystemApi 注解是什么意思,和@hide 有什么区别 2022-01-01
- - (CGRect)convertRect:(CGRect)rect toView:(UIView *)view 如何工作 2022-01-01
- 如何将多个组件添加到 PickerView? 2022-01-01
- 我的 UIImageView 的任务 2022-01-01
- 在 Android 模拟器中激活网络位置提供程序? 2022-01-01
- 可可/目标C(OSX不是iOS)从子对象访问父对象 2022-01-01
- 在 iOS8 中无法获得正确的键盘高度值 2022-01-01
- Android:STATE_SELECTED不工作 2022-01-01
- 在 appComponent dagger 2 中动态添加测试模块? 2022-01-01
- 突出显示朗读文本(在 iPhone 的故事书类型应用程序中) 2022-01-01
