Three-step walk:
The first step, the font file for the. ttf suffix in the project, font such as: http://www.webpagepublicity.com/free-fonts.html
Note: Drag into the 1, the arrow is selected, otherwise it will not be added to the bundle, if unchecked, you can add from Figure 2:
Figure 1:
Figure 2:
Step Two:
Open the Info.plist file, add the downloaded font. ttf file to the fonts provided by application array,
Step Three: Use
Label.font = [Uifont fontwithname:@ "antique" size:18]
UILabel *label = [[UILabel alloc] Initwithframe:cgrectmake ( -, -, $, +)]; Label.font= [Uifont fontwithname:@"Zapfino"Size -]; Label.text=@"This is a font-style"; [Self.view Addsubview:label]; UILabel*label2 = [[UILabel alloc] Initwithframe:cgrectmake ( -, -, $, +)]; Label2.font= [Uifont fontwithname:@"Antique"Size -]; Label2.Text=@"This is a font-style"; [Self.view Addsubview:label2]; NSLog (@"%@", [Uifont familynames]); for(NSString *strinch[Uifont Familynames]) { if([str isequaltostring:@"Antique"]) {//Check if the font is joinedNSLog (@"-----joined---"); } }
Effect:
Reference: http://blog.csdn.net/justinjing0612/article/details/8093985
How to add an app's own font in IOS