Use custom ttf font on iOS
If you want to use a third-party font in the project, you can query the solution on stackoverflow and try to add it. The example is as follows:
1. Add the xx. ttf Library to the project.
2. Add a new line of Fonts provided by application in the xx-Info.plist file of the project, with the name of the Library
3. reference the name of the library. Set the font to [UIFontfontWithName: @ "fontname" size: 24].
UILabel * label = [[UILabel alloc] initWithFrame: CGRectMake (10,100,300, 50)]; label. text = @ "this is a TEST. 123456 "; UIFont * font = [UIFont fontWithName: @" winding CS medium capacity "size: 24]; label. font = font; [self. view addSubview: label];
If you do not know the font name, you can traverse the font for query:
for(NSString *fontfamilyname in [UIFont familyNames]) { NSLog(@"family:'%@'",fontfamilyname); for(NSString *fontName in [UIFont fontNamesForFamilyName:fontfamilyname]) { NSLog(@"\tfont:'%@'",fontName); } NSLog(@"-------------"); }
: Http://download.csdn.net/detail/duxinfeng2010/7639683
Reference http://stackoverflow.com/questions/15447558/can-not-include-ttf-font-into-project