1. Search for font files online (suffix. ttf, or. odf)
2. Import the font library into the resouce of the project
3. Load a piece of code in the program Viewdidload
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, add key: uiappfonts, type array or dictionary, and set a key-value pair under Uiappfonts, key: Item 0, Add value to Xxx.ttf (the name of your font, string type), you can add multiple
6. In your project to use the font when xx.font = [Uifont fontwithname:@ "Microsoftyahei" size:20.0], so you can.
Settings for iOS fonts