how to add new font to Xcode 3.2?

為{幸葍}努か 提交于 2019-12-03 19:38:19

This functionality isn't built into UILabel/UIFont in iOS < 3.2. But there is a third-party solution you can use: FontLabel

In iOS 3.2+, there's the UIAppFonts plist key!

Just do this before using it: add your font file (such as myfont.ttf) to your project, then edit the Info.plist like so:

info.plist http://cl.ly/97da7a4f67b1b81a540f/content

The above methods worked for me in xcode 3.2! Thanks!:

step 1: drag your font into your project (prob a good idea to not have spaces in the font name) step 2: add a row to your info.plist file like shown above to enter your font. step 3: in, viewDidLoad() or wherever you are setting your label, enter code:

 UIFont *myFont = [UIFont fontWithName:@"secondbreakfast" size:40];
 myLabel.font = myFont;

I did it with the following way:

  1. Add the font type to the Xcode : Under the XIB, go the font setting -> manage font

  2. Add the font to the label:

    UIFont *myFont = [UIFont fontWithName:@"myfont" size:12]; label.font = myFont;

Hope it help

kuldeep

But in xcode 5

  1. Go to xcode preferences -> Fonts and colors.
  2. Then click on T button in the textField of Font.

A list of all colors open then click on setting button in bottom left corner and go to manage fonts

Here select All fonts and then add your own ttf file by clicking on plus button and your Font will be added.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!