Methods for customizing fonts in iOS development

Source: Internet
Author: User

1. First download the font library you want to set up, for example, set the simplified

2. When adding a project, be sure to check the red box. It is not checked by default.

 

After adding

3. Add

4. Now it has been added successfully, but you must know the FontName to use it. You can find it using the following code:

NSArray *familyNames = [[NSArray alloc] initWithArray:[UIFont familyNames]];    NSArray *fontNames;    NSInteger indFamily, indFont;    for (indFamily=0; indFamily<[familyNames count]; ++indFamily)    {        NSLog(@"Family name: %@", [familyNames objectAtIndex:indFamily]);        fontNames = [[NSArray alloc] initWithArray:                     [UIFont fontNamesForFamilyName:                      [familyNames objectAtIndex:indFamily]]];        for (indFont=0; indFont<[fontNames count]; ++indFont)        {            NSLog(@"    Font name: %@", [fontNames objectAtIndex:indFont]);        }    }

5. Because FontName in founder font starts with FZ, search for FZ in the printed logs.

The simplified FontName is the FZQTJW--GB1-0,

6. You can finally use it.

Self. label. font = [UIFont fontWithName: @ "FZQTJW--GB1-0" size: 20];

The following are the display results:

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.