This article reprinted to http://blog.csdn.net/yesjava/article/details/8447596
1. Download the custom font you want to use, usually in a TTF, OTF file. Here's a hypothetical nokia.ttf.
2. Import the Nokia.ttf file into Xcode's resources
3. Add fonts provided by application in the Xxx.plist file. The type is an array. XXX is the name of your project. Add an entry with a value of "Nokia.ttf".
4. Add the following code to the program initialization code:
Nsarray *familynames = [[Nsarray alloc] Initwitharray:[uifont Familynames]];
Nsarray *fontnames;
Nsinteger indfamily, Indfont;
for (indfamily=0; indfamily<[familynames count]; ++indfamily)
{
NSLog (@ "Family name:%@", [Familynames objectatindex:indfamily]);
FontNames = [[Nsarray alloc] Initwitharray:
[Uifont Fontnamesforfamilyname:
[Familynames objectatindex:indfamily]];
for (indfont=0; indfont<[fontnames count]; ++indfont)
{
NSLog (@ "Font name:%@", [FontNames Objectatindex:indfont]);
}
[FontNames release];
}
[Familynames release];
This allows you to find the name of the font you added by logging, and this is called "Nokiafontguyin".
5. Use this font. Uifont *font=[uifont fontwithname:@ "Nokiafontguyin" size:36];
iOS uses a custom font