My custom font is not displayed

I am trying to use my own font in my iPhone application.

I created a key for this in my info.plist as follows:

<key>UIAppFonts</key>
<array>
        <string>CloisterBlack.ttf</string>
</array>

and I access the font as follows:

[UIFont fontWithName:@"CloisterBlack" size:64.0]

but the font is not displayed. What could be the reason?

+5
source share
3 answers

Make sure you include the real font name in the above code. The font file name and its "real font name" may be different, so just open the font in the FontBook application and there you will see the real font name.

+5
source

" " , Fontbook. - , , .

uifont-name-grabber, : http://forgecode.net/2010/08/uifont-name-grabber/

xcode, plist , , , , UIFont fontWithName: .

0
  • info.plist
  • , . :

    NSArray * fontFamiliesTemp = [UIFont familyNames]; for (int = 0; < [fontFamiliesTemp count]; ++) {   NSString * fontFamily = [fontFamiliesTemp objectAtIndex: i];   NSArray * fontNames = [UIFont fontNamesForFamilyName: [fontFamilies objectAtIndex: i]];   NSLog (@ "% @:% @", fontFamily, fontNames); }

  • Find the font in the printed results. After that, you will only need to use this font name.

0
source

All Articles