First, iOS native font acquisition and display
1.xib/storyboard Graphic Display
Drag to create a Label control, select the label, modify the label font system to custom in the settings, and then click the Family box to see all the native fonts.
2. Code get fonts and Settings
Many times we are programming with pure code, so how do we set the text font?
In fact, we can use two for loop to remove all the font names, and then according to their own needs to set the font.
Get all font name codes:
1- (void) getallfont{2 for(NSString * Fontfamilynameinch[Uifont Familynames]) {3 for(NSString * FontNameinch[Uifont Fontnamesforfamilyname:fontfamilyname]) {4NSLog (@"font:%@", fontname);5 [Self.fontarray addobject:fontname];6 }7 }8 [Self.tableview Reloaddata];9}
Second, the introduction of third-party fonts (as long as the. TTF font files can be)
1. Add Settings
When we are in the process of development, sometimes iOS native fonts do not meet our needs, we can introduce some third-party fonts (whether Android or Windows), as long as the font is in TTF format, the general iOS program supports inline.
Implementation steps:
1.1 First you want another third-party font file Xxx.ttf (the TTF font I tested was downloaded here: http://www.font5.com.cn/tag.php?tag=TTF%D7%D6%CC%E5) Blog Park seemingly can not insert links, nausea ...
1.2 then drag the. ttf file into the project
1.3 Configuring the Info.plist file
1.4 Then the third-party font was introduced successfully.
2. Display third-party fonts
2.1 Xib/storyboard Graphic display
Whether it's Xib/storyboard graphics showing third-party fonts or code showing third-party fonts, the method is the same as showing the original iOS fonts (see the first step directly)
Source code: Link: https://pan.baidu.com/s/1pLAcf5h Password: S3RF
IOS fonts in a detailed