Using custom Fonts
Way one: Local fonts imported to the Engineering directory use first, to find a font package download down, I use the founder of the Orchid Pavilion Special Black Simplified (Figure 1), 2.5M size
Drag to the engineering directory to ensure that this package is visible in copy Bundle resources (Figure 2)
Configure plist: Add a field to Info.plist fonts provided by application adds an item to the name of the font package (Figure 3)
Someone on the blog said next to open the font pack Note name (Figure 4) can be used as a font name
I can't do this, I printed the list of the current fonts in the system
Nsarray * Fontsarray = [Nsarray alloc] Initwitharray: [Uifont Familynames]]
For (NSString *font in Fontsarray) {
NSLog (@ "Font Name =%@\n", font);
}
Find imported fonts (Figure 6)
and then you can use the
[Uifont fontwithname:@ FZLANTINGHEI-H-GBK size:17] Two: Using fonts downloaded from the server
download fonts to Local
New Uifont class extension Uifont+customfont
Implementation
+ (uifont*) Customfontwithpath: (nsstring*) path size: ( CGFloat) size
{
Nsurl *fonturl = [Nsurl Fileurlwithpath:path];
Cgdataproviderref fontdataprovider =cgdataprovidercreatewithurl ((__bridge cfurlref) fontUrl);
Cgfontref fontref = Cgfontcreatewithdataprovider (Fontdataprovider);
Cgdataproviderrelease (Fontdataprovider);
Ctfontmanagerregistergraphicsfont (Fontref, NULL);
NSString *fontname = Cfbridgingrelease (Cgfontcopypostscriptname (fontref));
Uifont *font = [Uifont fontwithname:fontname size:size];
Cgfontrelease (FONTREF);
return font;
}
You know
[Uifont Customfontwithpath:fontfilepath size:20];