108

I'm using a label to display text with my custom font on LaunchScreen.xib. My custom font shows up fine in the Interface Builder, but when I test it on my iPhone the font reverts back to the default font.

Not sure how to fix this or if it's a bug.

yoshiiiiiiii
  • 953
  • 8
  • 20
user3781632
  • 1,618
  • 2
  • 12
  • 15
  • 4
    I guess I'm not surprised. The launch screen is shown at launch time - actually, _before_ launch time - so the font probably hasn't yet loaded. – matt Feb 10 '15 at 23:30
  • It sounds like there's no way to fix it then? Would I just be better off using a launch image? – user3781632 Feb 10 '15 at 23:33
  • 1) Use image 2) Use system fonts – Midhun MP Feb 10 '15 at 23:42
  • 1
    possible duplicate of [Using custom fonts with Xcode 6 / iOS 8 Interface Builder Launch Screen](http://stackoverflow.com/questions/25794314/using-custom-fonts-with-xcode-6-ios-8-interface-builder-launch-screen) – NobodyNada Feb 10 '15 at 23:45
  • 4
    @NobodyNada The problem with that "duplicate" is there's no satisfactory answer there. – matt Feb 11 '15 at 00:24
  • 2
    I would just omit the element with the text in it. Launch images are supposed to be minimal - just the bare outline of the structure, which gets filled in when the real interface appears. – matt Feb 11 '15 at 00:25

2 Answers2

104

There's no big surprise here. The launch screen is shown at launch time - actually, before launch time - so the font probably hasn't yet loaded.

You could file a bug if you think you have a compelling use case. But I don't really think you do. Why are you showing any text in your launch image? It should be much more bare-bones than that - just enough to give the structure of the opening interface, which will be filled in when the opening interface actually appears. A "blank" screen with the same background color as the initial view controller's background color would be sufficient. You goal is just to provide an alternative to blackness.

matt
  • 515,959
  • 87
  • 875
  • 1,141
  • 36
    The idea was to have my app's title on that screen with a consistent font throughout the app. Ended up adding a UIImage of my title to the xib instead. – user3781632 Feb 12 '15 at 01:35
  • 17
    Also, Apple's default "LaunchScreen.xib" has the app's name in a plain ol' UILabel... The least we can do is select a font.... :) – Alex Zak Jun 24 '15 at 17:01
  • @AlexZak You can select a font. Just not a font loaded in your app bundle. Besides, you're expected to delete that label. – matt Jun 24 '15 at 17:10
  • 3
    @matt You're right, I meant select a custom font... But I'm not sure you're "expected" to delete it, we had to push an app really fast, and forgot to update the launch screen, and apple approved nonetheless... – Alex Zak Jun 25 '15 at 10:03
  • 1
    Do what you want with your app. Apple guidelines are very explicite on how splash screens should be, it's up to you to adhere to it or not. – Antzi Oct 27 '15 at 16:41
  • 13
    It amazes me that there's any argument at all against showing ones company name in their launch screen. – Leon Jul 03 '18 at 10:28
  • 1
    You make a good point. But no need to yell. Thanks anyway. :) – AsifHabib Oct 08 '19 at 08:20
  • Aaargh! Just spent like half a day trying to figure out what was going on until I narrowed it down to my custom font not working on only the launch screen storyboard. Explanation completely makes sense. – Evan R Sep 01 '20 at 04:40
12

A quick workaround is to use an UIImageView and have your text as UIImage on it, literally a picture of your text as .png / .jpeg or similar.

Note: It may take some time before you can see the image, I had to clean the Build Folder and reinstall the app a couple of times in order to see the image.

Another note: If you want to support multiple languages with different texts you will need to have different images for each language using this approach.

Gustavo Vollbrecht
  • 3,188
  • 2
  • 19
  • 37