1. Search for font files online (suffix. ttf, or. odf)
2. Import the font library into the resouce of the project
3. In the program add the following code to output all fonts
Nsarray *familynames = [Uifont familynames];
For (NSString *familyname in familynames) {
printf ("Family:%s \ n", [Familyname utf8string]);
Nsarray *fontnames = [Uifont fontnamesforfamilyname:familyname];
For (NSString *fontname in fontnames) {
printf ("\tfont:%s \ n", [FontName utf8string]);
}
}
4. If you add the font to Microsoft Jas, then you can see the Microsoftyahei in NSLog
5. Then create a new line (add row) in your project's Info.plist file and add the key: fonts provided by application is an array by default, the type is array or dictionary, and a key value pair is established under Uiappfonts, key is: Item 0, Add value to Xxx.ttf (the name of your font, string type), you can add multiple
6. When using fonts in your project Xx.font = [Uifont fontwithname:@ "Microsoftyahei" size:20.0], this is OK.