The project would like to use a third-party font, query the solution on the StackOverflow, also toss a while, add success, examples are as follows:
1. Add the Xx.ttf font library to the project
2. Add a new line Fonts provided by application in the project's Xx-info.plist file , plus the name of the font library
3. Reference the name of the font library and set the font: [uifontfontwithname:@ "FontName" size: - ];
UILabel *label = [[UILabel alloc] Initwithframe:cgrectmake (ten, +, +)]; Label.text = @ "This is a test. 123456 "; Uifont *font = [Uifont fontwithname:@ "Wen Ding cs Medium line" size:24]; Label.font = font; [Self.view Addsubview:label];
If you do not know the font name, you can traverse the font to query:
For (NSString *fontfamilyname in [Uifont familynames]) { NSLog (@ "Family: '%@ '", fontfamilyname); For (NSString *fontname in [Uifont Fontnamesforfamilyname:fontfamilyname]) { NSLog (@ "\tfont: '%@ '", FontName) ; } NSLog (@ "-------------"); }
Example demo:http://download.csdn.net/detail/duxinfeng2010/7639683
Reference Http://stackoverflow.com/questions/15447558/can-not-include-ttf-font-into-project