Add a custom font to iOS

Source: Internet
Author: User

I thought the custom font is how complicated work, in fact, for our siege lion rinsed things, remember one interview was asked this question, suddenly asked, because did not contact before.

Do not be intimidated by the problem, the first step: To download the font library online, there are two files. OTf and. TTF, iOS5.0 can only be used after the. OTf. TTF is not limited, so here we select the. ttf file to drag into the project

Step Two: Add font configuration information to the Info.plist to add font text to the project. Such as:

Step Three: You can check if the file has been added to the project, Build phases, Code boundle resourses


Fourth: At the most critical time, is how to use.

eg

Uifont *font = [Uifont fontwithname:@ "Microsoftyahei" size:18.0f];

Finished, it is so simple, read the classmate, remember the next time someone asked you do not forget, direct answer, so simple how can not know it. A little bit more students, directly said I have a font library, and then is to add it. Haha, the addition of custom fonts is here.

Add a custom font to iOS

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.