自定义字体在 iPhone 设备上不起作用
我正在尝试将外部 .ttf 字体加载到我的 iOS 项目之一中。该字体在模拟器中工作正常,但无法在实际设备上显示。
我正在使用 LLVM GCC 4.2 编译器。在另一个项目中,使用 Apple LLVM 编译器 3.0,可以使用相同的字体。我不明白我该如何解决它?使用 LLVM GCC 4.2 编译器需要遵循哪些步骤?
I am trying to load an external .ttf font into one of my iOS projects. The font works fine within an emulator, but fails to display on an actual device.
I am using the LLVM GCC 4.2 compiler. In another project, with the Apple LLVM compiler 3.0, the same font works. I do not understand how I can fix it? What are the steps I need to follow with the LLVM GCC 4.2 compiler?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
确保将其添加到“目标”下 -> '构建阶段' -> “复制捆绑资源”。我遇到了类似的问题,通过手动将其添加到此列表中,字体开始显示在设备上。
Make sure it's added under 'Targets' -> 'Build Phases' -> 'Copy Bundle Resources'. I had a similar problem and by manually adding it to this list, the font started showing up on the device.
对于下面的自定义字体代码帮助
您也可以下载示例代码和教程 这里。
For the Custom font below code help
Also u can download sample code and tutorial here.
关于字体的选择有限,因此您必须在可用字体之间进行选择...
这个答案可作为参考:
iPhone 应用程序支持哪些字体?
You have a limited choice regarding fonts, so you have to choose between the fonts available...
This answer is useful as a reference:
What fonts do iPhone applications support?
首先按如下方式加载字体:
然后按如下方式使用它们:
在某些情况下,您可能无法使用某些互联网下载的字体。 这里是相同的参考:
First load the font like below:
Then use them as below:
There are some cases where you may not able to use some of the internet downloaded font. Here is the reference for the same: