In the previous several projects, the customer required to use the font, but iOS didn't bring this font.
You can only customize the font. The following are several important steps to customize the font:
1. Download the Font Resource file (. ttf or. otf format file)
For example, if you want to use the font, You need to download the font file.
It should be noted that. otf files can only be used after iOS, so if your system needs to be used in versions earlier than iOS5.0, it is best to use. ttf font files.
2. Add the font configuration in info. plist.
Add the downloaded font file to the project and go to info. in the plist file, add the "Fonts provided by application" configuration item. For example, the file name of my Font Resource is msyh. ttf, then in info. after this item is added in plist, the effect is as follows:
3. Use a Custom font in the code
Example:
[Cpp]
UITextView * msg = [[UITextView alloc] init];
Msg. font = [UIFont fontWithName: @ "MicrosoftYaHei" size: 18366f]; // MicrosoftYaHei indicates the font name. Here it is the font.