This article reprinted to http://blog.csdn.net/yhawaii/article/details/7911290
Several previous projects, customers have asked to use Microsoft Jas font, but iOS did not bring this font, swollen
You can only customize fonts yourself, here are a few important steps for customizing fonts:
1. Download the font resource file (. ttf or. otf file format)
For example, if you want to use Microsoft Jas font, you need to download Microsoft Jas font file.
It is important to note that. otf format files can only be used after iOS5, so if your system needs to be used in a version prior to iOS5.0, it's best to use the. ttf Format font file
2. Add font configuration to Info.plist
Add the downloaded font file to the project, and in the Info.plist file, add the "Fonts provided by Application" configuration item, such as my Microsoft Jas font resource file named: Msyh.ttf, The effect after adding the item in Info.plist is as follows:
3. Use a custom font in your code
Examples of use are:
[CPP]View Plaincopy< param name= "allowfullscreen" value= "false" >
- uitextview *msg = [[uitextview alloc] init];
- msg.font = [uifont fontwithname:@< Span class= "string" > "Microsoftyahei" size:18.0f]; //microsoftyahei is the name of the font, here is the Microsoft Jas Black font