Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

custom font shows on storyboard, but not on simulator, device

first time using SO to ask a question after lurking for so long.

I have added a custom font for some UITextFields and UITextViews in the Storyboard.... screenshot of storyboard

...but the fonts are not showing on the Simulator, nor the actual device (iPad 2, iPad Mini3). screenshot of simulator

Please advise on how you got through this, or any additional information that you may need. Thanks! Running XCode 7.3.1 on El Capitan 10.11.6.

The iOS Application in development is set for running on iOS 9.3 and above.

like image 247
fatyandao Avatar asked Sep 05 '16 13:09

fatyandao


2 Answers

You should add custom fonts to your application folder (TTF/OpenType) and then, modify the application-info.plist file. Add the key "Fonts provided by application" to a new row

It supports TTF and OpenType fonts both. One caveat is that it loads and parses all fonts in the startup of your app, so it will slow down the initial load time.

You also have to add the fonts to the "Copy Bundle Resources" in the Build phases.

like image 149
Chaithanya Prathyush Avatar answered Sep 21 '22 20:09

Chaithanya Prathyush


Check that your font file's (exp. Chewy.ttf) target is set to the app target.

Steps:

  1. select the font file
  2. Check target membership in File inspector
like image 22
Vishwas Singh Avatar answered Sep 24 '22 20:09

Vishwas Singh