Today made a custom font of the lable program, the design said the system is not in line with the artistic atmosphere, so designed a custom font, added to the project.
1. The first step is to find the TTF format for the font you want to use. Add to the Resouce directory of your project .
2. In the plist of the project AddRow, "Fonts provided by Application", then add the key for Item0,value as you just joined Aragones.ttf.
Yes, you can add multiple, use the time to write the corresponding font name on the line
3. You can use it directly in your project. Xx.font = [Uifont fontwithname:@ "aragones" size:20.0];
Attention:
In the program, first add this code, run,
Nsarray *familynames =[[nsarray Alloc]initwitharray:[uifont Familynames]]; Nsarray *fontnames; Nsinteger indfamily, Indfont; NSLog (@ "[Familynames count]===%d", [familynames Count]); 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];
View console, The above program will list all the fonts, of course, also contains "Fonts provided by Application" the added font, but please note that the name may be very large, you have to find the
Aragones.TTF , join fonts provided by Application
execute the above program will list
2012-10-20 21:56:21.321 myanimationtest[5397:c07] Family name:hakuyoguifanzi35002012-10-20 21:56:21.321 MYANIMATIONTEST[5397:C07] Font name:hakuyoguifanzi35002012-10-20 21:56:21.322 myanimationtest[5397:c07] Family name:didot2012-10-20 21:56:21.322 myanimationtest[5397:c07] Font name:didot-italic2012-10-20 21:56:21.322 MYANIMATIONTEST[5397:C07] font name:didot2012-10-20 21:56:21.323 myanimationtest[5397:c07] font name: didot-bold2012-10-20 21:56:21.323 myanimationtest[5397:c07] Family name:bodoni, smallcaps2012-10-20 21:56:21.323 MYANIMATIONTEST[5397:C07] Font Name:bodonisvtytwoscitctt-book
to use the family name of the font instead of the file name of the font, you will not see the effect if you make a mistake. If you are using a font style alone, you can also use the font name to see personal preferences.
Effect:
you can download more TTF fonts in http://www.webpagepublicity.com/free-fonts.html.
iOS how to add your own fonts------lable set a custom font