How to Use the font in IOS

Source: Internet
Author: User

1. Search for font files on the Internet (the suffix is. TTF or. ODF)

2. Import the Library to the resouce of the project.

3. InProgramLoad a section in viewdidloadCode

Nsarray * familynames = [uifont familynames];
For (nsstring * familyname in familynames ){
Printf ("Family: % s \ n", [familyname utf8string]);
Nsarray * fontnames = [uifont fontnamesforfamilyname: familyname];
For (nsstring * fontname in fontnames ){
Printf ("\ tfont: % s \ n", [fontname utf8string]);
}
}

4. If the font you added is, You can see microsoftyahei in nslog.

5.
Create a new line (add
Row), add the key: uiappfonts, the type is array or dictionary; create another key-Value Pair under uiappfonts, key
Is: Item 0, add value XXX. TTF (your font name, string type), you can add multiple

6. When the font is used in your project, XX. font = [uifont fontwithname: @ "microsoftyahei" Size: 20.0.

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.