How to add an app's own font in IOS

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.