我们如何在 iOS 应用中使用自定义字体? [英] How can we use custom font in an iOS app?

查看:20
本文介绍了我们如何在 iOS 应用中使用自定义字体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能的重复:
我可以在 iPhone 应用程序中嵌入自定义字体吗?

如何在我的 iPhone 应用程序中自定义字体?是否可以?如何在 UILabel 中使用这种自定义字体?

How can I customize font in my iPhone app? Is it possible? How can I use this custom font in a UILabel?

我正在尝试在我的应用中添加 MYRIADPRO-SEMIBOLD.OTF 字体.

I am trying to add MYRIADPRO-SEMIBOLD.OTF font in my App.

代码是

UIFont *customFont = [UIFont fontWithName:@"MYRIADPRO-SEMIBOLD" size:35]; 
titleLbl.font = customFont; 

Plist 是

推荐答案

请尝试以下步骤:

1.在info.plist中进行配置,如图

2.现在您应该使用添加的文件

UIFont *customFont = [UIFont fontWithName:@"fontName" size:size];

// further you may set That Font to any Label etc.

确保您已将该文件添加到您的资源包中.

Make Sure you have added that file in your resources Bundle.

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

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