在iPhone应用程序中使用自定义字体 [英] Use custom fonts in iPhone App

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

问题描述


可能重复:

我可以在iPhone应用程序中嵌入自定义字体吗?

如何在我的iPhone应用程序中自定义字体?
是否有可能?
我怎样才能给这个自定义字体的标签?
任何人都可以提出一个好方法吗?

Iam尝试在我的应用程序中添加MYRIADPRO-SEMIBOLD.OTF字体。

和代码是

  UIFont * customFont = [UIFont fontWithName:@MYRIADPRO-SEMIBOLDsize:35 ]。 
titleLbl.font = customFont;

而Plist是

解决方案

试试下面的步骤。

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


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

  UIFont * customFont = [UIFont fontWithName:@fontName大小:大小]; 

//此外,您可以将该字体设置为任何标签等。

编辑:确保您已经在资源包中添加了该文件。


Possible Duplicate:
Can I embed a custom font in an iPhone application?

How can I customize font in my iphone app? Is it possible? How can I give this custom font for a label ? Can anyone suggest a good method?

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

and the code is

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

And the Plist is

解决方案

Try below Steps.

1 Make configuration in info.plist as shown in Image

Now You SHould Use That Added File

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

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

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

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

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