iOS uses its own font definition

Source: Internet
Author: User

1. Add the appropriate font (. ttf or. odf) to the resurce of project, such as My.ttf.


2. In Info.plist, add a Fonts provided by application (item0 corresponding value My.ttf, adding multiple fonts in turn to be able to).
3. When using alabel.font=[uifontfontwithname:@ "XXX" size:30]; Note that XXX is not necessarily my, this is return to CASTLE.


You can view familyname and FontName in the following ways, for example:

Nsarray *familynames = [Uifont familynames];        for (NSString *familynameinfamilynames) {printf ("Family:%s \ n", [familynameutf8string]);        Nsarray *fontnames = [Uifont fontnamesforfamilyname:familyname];        for (NSString *fontnameinfontnames) {printf ("\tfont:%s \ n", [fontnameutf8string]); }    }


Scenario 2:

The answer is discussed in iOS3.2 once and after the practice, now 5.1, is expected to support 3.2 once the app is very few bar.

So I attached the iOS3.2 to the following.

In simple terms. is iOS3.2 Apple supports its own definition of the font, only need to set the Info.plist file uiappfonts related information. Procedures such as the following:

    1. Add your own definition font to your project resource file
    2. Add a key to uiappfonts in the Info.plist file
    3. Change this key into an array
    4. The name of all the fonts you will use. As the value of this array, an entry is entered (with the extension)
    5. Save Info.plist
    6. Now you can use [Uifont fontwithname:@ "Customfontname" size:12] in your code to get your own defined font.
Source: Http://stackoverflow.com/questions/360751/can-i-embed-a-custom-font-in-an-iphone-application

iOS uses its own font definition

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.