开发者

how to add new font to Xcode 3.2?

开发者 https://www.devze.com 2023-01-09 08:31 出处:网络
please tell me how to add new fo开发者_StackOverflow中文版nt to iphone xcode3.2.This functionality isn\'t built into UILabel/UIFont in iOS < 3.2. But there is a third-party solution you can use: Fo

please tell me how to add new fo开发者_StackOverflow中文版nt to iphone xcode3.2.


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:

how to add new font to Xcode 3.2?


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号