1. Add the prepared font file to the project
2. Open the build phases-copy Bundle Resources to make sure the font file you just added is in the list, otherwise you'll need to add it manually.
3. Edit the "project name-info.plist" file
(1) Addrow-fonts provided by application
(2) Fill in the name of the added font with the extension
4. Double-click the font file under Mac to find the font fontname in the title bar
5. Print out all the font names of the system
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 is%@", [FontNames Objectatindex:indfont]); } [FontNames release]; } [Familynames release];
6. This allows the use of [Uifont fontwithname:@ "chenweixun-yingxing" size:20];
7. Only the words in the file will be converted.
iOS uses a custom font