将.otf字体添加到iphone应用程序 [英] Add .otf font to iphone application

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

问题描述

我正在尝试使用自定义.otf字体到我的应用程序,但是不起作用,我已经尝试过.ttf字体并且工作,但.otf没有,任何人都可以帮助我?有办法添加.ot​​f字体?我阅读了很多添加字体的指南,但是对于.otf不起作用,这就是字体:



,您应该尝试使用它。例如,如果你有 * myTextField 指向 UITextField 的指针,并且你想使用DIN-Medium 13pt你可以这样设置你的自定义字体:

  myTextField.font = [UIFont fontWithName:@DIN-Medium尺寸:13.0f ]。 


i'm trying to use a custom .otf font to my application, but don't work, i have tried the .ttf font and work, but the .otf don't, anyone can help me? there is a way to add .otf font? i read a lot of guide to add font, but for the .otf don't work, this is the font:

http://www.fontsquirrel.com/fonts/Lobster

解决方案

You need to ensure that you are using the correct name with fonts. It's tricky. Try to open the font with fontbook in mac, or the equivalent in windows. On a mac, when you open the font in fontbook, you should be able to see the exact name under "PostScript name":

Then, assuming that you have properly added the font to your project, you should attempt to use it. For example, if you have a *myTextField pointer to a UITextField, and you want to use DIN-Medium 13pt you may set your custom font like so:

myTextField.font = [UIFont fontWithName:@"DIN-Medium" size:13.0f];

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

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