ViES
ViES

Reputation: 371

Xcode 7.2.1 Custom font in Interface bulilder

How use custom font with label in Xcode 7.1.2? I created a group and added my fonts files into project. In interface builder chose custom font, family and style(Acrom ExtraBold 20.0). In IB all looks fine, but not in simulator - displays system default font. Also I've added 'Fonts provided by application' array with list of my fonts files to Info.plist and installed font on the machine.

Upvotes: 2

Views: 271

Answers (1)

Gordonium
Gordonium

Reputation: 3487

Final Edit:

If you don't mind, I'll reword your question as I understand it much better now that you've kindly supplied me with your project.

In short your question is this:

My custom font does not work in my launch storyboard despite the fact that it works elsewhere in the main app. How can I make it work in the launch screen?

It appears that you can't use custom fonts in a launch screen as they haven't yet been loaded. There are a number of answers on Stack Overflow confirming this. See here, here and here.

My advice would be to either avoid using the fonts in the storyboard or use them as an image.


Let's go through a number of the steps one-by-one to see if we can pinpoint the problem here.

Step 1. In your plist have you included the fonts under UIAppFonts aka Fonts provided by application? Like this:

enter image description here

Step 2. Also, have you made sure that the correct targets are selected? Like this:

enter image description here

Step 3. Also, try running this to see if your fonts are listed. If not then make sure they are spelled exactly as the filenames.

NSArray *familyNames = [[NSArray alloc] initWithArray:[UIFont familyNames]];
NSLog(@"Fonts: %@", [UIFont familyNames]);

Step 4. Another also - check the Font Book application on your mac, search for the font and find its correct name. Like this:

enter image description here

Step 5. Then check that the font is included in the bundle resources for the project like this:

enter image description here

Step 6. And finally double check that you selected to copy the fonts to the bundle when you added them to your project, like this:

enter image description here


Edit

It seems that the font works for you iff you refer to it in code but not if you refer to it using IB. So maybe...

Step 7. Delete the app from the simulator, clean the project and then rebuild.

enter image description here

Upvotes: 0

Related Questions