如何将自定义字体添加到 iPhone 应用程序? [英] How to add custom fonts to an iPhone app?

查看:25
本文介绍了如何将自定义字体添加到 iPhone 应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须怎么做才能获得带有自定义字体的 UIFont 对象?我记得 Info.plist 文件中也发生了一些事情.

What must I do to get an UIFont object with a custom font? I remember there was also something going on in the Info.plist file.

支持哪些字体文件格式?

What font file formats are supported?

推荐答案

要将自定义字体添加到您的应用程序,您可以将它们添加到 XCode 项目中.然后,修改 application-info.plist 文件.将键 Fonts provided by application 添加到新行.为您添加的每种字体添加一项.

To add a custom font to your application, you can add them to the XCode project. Then, modify the application-info.plist file. Add the key Fonts provided by application to a new row. Add one item for each font you have added.

它同时支持 TTF 和 OpenType 字体.需要注意的是,它会在您的应用启动时加载和解析所有字体,因此会减慢初始加载时间.

It supports both TTF and OpenType fonts. One caveat is that it loads and parses all fonts in the startup of your app, so it will slow down the initial load time.

我相信这仅适用于 iOS 3.2 或更高版本.

I believe this is only available in iOS 3.2 or later.

这篇关于如何将自定义字体添加到 iPhone 应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆