Add Custom Fonts In Xcode 4.1

前端 未结 4 1572
礼貌的吻别
礼貌的吻别 2021-02-04 05:44

i want to use custom fonts in y application.

i have declared the \"Fonts provided by the application\" in the info.Plist file

and set the label.font to the font

相关标签:
4条回答
  • 2021-02-04 05:55

    I just spent a big chunk of my day trying to figure my problem out... what I missed was, when I dragged the .ttf file into xcode, I did not select my app's name under "Add to target:" section.

    Even though it seemed as if the file was in the correct directory and what not, it wasn't recognising it under the family names, using this code:

    NSLog(@"FONT FAMILIES\n%@",[UIFont familyNames]);
    

    So hopefully this can help someone if they're stuck.

    0 讨论(0)
  • 2021-02-04 06:08

    The font name isn't the name of the file. What you want to do is double click on the font in Finder.

    This should open it in Font Book like this image

    The font name you want is the one in the title which I've highlighted so attractively in red.

    0 讨论(0)
  • 2021-02-04 06:16

    The above advice did not work for me, so I wanted to share what did:

    Opening the font in Finder gave a long name that did not work (TypeWrong Smudged - DGL), but when I looked for the same font in the Photoshop font list it showed the name as just TypeWrong, which did work. So if Finder shows a long name with spaces in it, you might want to try just using the first space-free chunk.

    0 讨论(0)
  • 2021-02-04 06:22

    You have to check what is the font name it is at times different from font file name...

    check this link

    0 讨论(0)
提交回复
热议问题