11

I have tried deleted font from the xcode project and and copied again by dragging, but still custom font named "Helvetica-Neue-LT-Com-75-Bold-Outline.ttf" is not working on iphone 4 and 5c simulator but working in 5s simulator.

To set the font name to UILabel, I am using the name from fontbook app.

Parth Pandya
  • 1,460
  • 3
  • 18
  • 34

5 Answers5

44

Follow this steps,it's work fine

1.Select the project

2.Select Targets->Build Phases->Copy Bundle Resoures->Click + Button->Add your Custom font

Like this:

enter image description here

SwiftiSwift
  • 7,528
  • 9
  • 56
  • 96
Preetha
  • 753
  • 9
  • 12
14

Few things after including the font files in your project:

  1. Include them in the target
  2. Include them as bundle resources
  3. Include them on your app's plist
  4. Make sure you're referring to the correct font name.

You can log all fonts by putting this on your app delegate's didFinishLaunchingWithOptions:

for (NSString* family in [UIFont familyNames])
{
    NSLog(@"%@", family);

    for (NSString* name in [UIFont fontNamesForFamilyName: family])
    {
        NSLog(@"  %@", name);
    }
}

Details here: http://codewithchris.com/common-mistakes-with-adding-custom-fonts-to-your-ios-app/

aj_f
  • 932
  • 7
  • 12
  • In my case it is logging "pirulen" my custom font and it is also showing when selecting from interface builder but when I run the app it is not showing and picking up the default font. – Muhammad Sarim Apr 25 '18 at 08:51
9
  1. Delete application from simulator
  2. Clean (by hitting "CMD + K" in Xcode)
  3. Run again
Rashwan L
  • 38,237
  • 7
  • 103
  • 107
l0gg3r
  • 8,864
  • 3
  • 26
  • 46
9

My problem was that I had a fonts folder which contained my font files, and I added the file by selecting "Create folder references" instead of "Create groups".

When I did this, my fonts folder was blue (instead of yellow), and only the font folder appeared in bundle resources; the individual font files contained in the folder did not.

When I added the folder by selecting "Create groups" the individual font files were added to bundle resources and the fonts appeared in the simulator.

SnoopyProtocol
  • 911
  • 8
  • 10
4

Make sure you're not loading this custom font in the Launch Screen of the App. You can use images instead.

Custom fonts are not Loading in the LaunchScreen.storyboard

Lahiru Pinto
  • 1,621
  • 19
  • 20