uilabel自定义字体? [英] uilabel custom font?

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

问题描述

我搜索了一种将自定义字体添加到iphone应用程序的方法,在某些情况下我成功了。但在我的情况下,我想导入Helvetica系列中的Helvetica Condensed Black,但它既不是mac的原生也不是iPhone的。

I searched for a way to add my custom font to iphone app and I was successful in some cases. but in my case I want to import "Helvetica Condensed Black" which in the Helvetica family but it is neither mac's native nor iPhone's.

当我在取景器中打开字体时我找到了一个名为Helv Condensed的文件,没有扩展名。
我经历过并将此文件添加到我的资源中并添加到plist中。就像我用另一种扩展名为.tff的字体一样,这是一次成功的尝试。

when I open the font in the finder I find a file named : "Helv Condensed" with no extension. I went through and added this file to my resources and also to plist. the same way that I did with the other font which had .tff extension and it was a successful attempt.

所以问题是我应该如何添加这个字体在helvetica中字体系列,但不是我的应用程序的原生iphone。还有什么方法可以将这些字体添加到界面构建器中吗?

so question is how should I add this font which is in helvetica font family but not iphone native to my application. Also is there any way to add these fonts to interface builder?

谢谢。

推荐答案

你必须将它添加到应用程序的info.plist中的UIAppFonts键,然后你可以在代码中使用它,你不能直接将它添加到Interface Builder。

You have to add it to the UIAppFonts key in your app's info.plist, and then you can use it in code, you can't add it to Interface Builder directly.

我发现这篇文章非常有用我可以在iPhone应用程序中嵌入自定义字体吗?

I found this post quite helpful Can I embed a custom font in an iPhone application?

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

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