How to use Custom font in iPhone SDK/Objective c.
Is Your designer gives you a artistic font which is not available on iPhone?
Well in iOS sdk you can use any font you wish.
- Add your custom font into your project , i.e. Dragged the font's ttf file (
CALIBRIZ_0.TTF
) into your resource folder from finder and check the "copy file to project folder" option. ) - Edit Info.plist: Add a new entry with the key Fonts provided by application.
- For each of your files, add the file name to this array
Now set font to your label
MyLabel.font = [UIFont fontWithName:@"Calibri" size:16];
Make sure you give real font name in above code. The font file name and its “real font name” can be different. - I opened the font in font book (double click on your font in finder) to see what the real filename is and I see this:
But it is not real name of font, so i opened it in FontBook and found that its real name is Calibri.
Comments
Post a Comment