Transferred from Http://www.jb51.net/article/81306.htm
Sometimes you might want to add a Third-party font library for the beauty of the interface. How to use it.
1. Add a font library to your project.
2. Add a new column to the Info.plist as shown below.
If you need to add more than one font, then click "+" to add
3. Add the font added to Info.plist in Target–>build phases–>copy Bundle. Otherwise, there will be no resources found
4. Sometimes the file name and the real font name are different. For example, the screenshot used is Test.ttf, this is not the real font name. At this time we also need to find the real usable fontname.
For (NSString *familyname in [Uifont Familynames]) {
NSLog (@ "familyname:%@", familyname); if ([familyname isequaltostring:@ "test"]) {//start with a judgment condition, it is not possible to find this.
for (NSString *fontname in [Uifont Fontnamesforfamilyname:familyname]) {
NSLog (@ "fontname:%@", fontname); }
NSLog (@ "=====");
}
This time, because we are not sure what the name is. Too many results were printed. The simple way to do this is to double-click the font library and use the font book to open it by default. This is the status bar that shows the real familyname. In this way, we can easily search the console for the desired results through the printed results above.