please tell me how to add new font 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:
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:
Add the font type to the Xcode : Under the XIB, go the font setting -> manage font
Add the font to the label:
UIFont *myFont = [UIFont fontWithName:@"myfont" size:12]; label.font = myFont;
Hope it help
But in xcode 5
- Go to
xcode preferences
->Fonts and colors
. - Then click on
T
button in thetextField
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.
来源:https://stackoverflow.com/questions/3350131/how-to-add-new-font-to-xcode-3-2