3
  1. Copy the .ttf files to the project.
  2. Confirm the .ttf files have set the project as target.
  3. Added the .ttf files in 'Fonts provided by application' in plist.
  4. In Build Phases, the .ttf files are in 'Copy Bundle Resources'.
  5. Install the font on my Mac.
  6. Try to print out all fonts available but I can't see my custom font.
  7. I tried to install a font in the code, ios 10 and below works, but ios 11 does not.

Fonts provided by application' in plist

G.Rizvan
  • 39
  • 4
  • do you see your font on Mac? have you tried to run it on ios 10 simulator? – swift2geek Oct 25 '17 at 10:12
  • В interface builder да. https://i.stack.imgur.com/qgzMA.png. And on the simulator and on the device checked. – G.Rizvan Oct 25 '17 at 10:24
  • possible duplicate & works in `iOS11` https://stackoverflow.com/questions/40168344/xcode-8-custom-font-doesnt-show-up-in-interface-builder/40170579#40170579 – Joe Oct 25 '17 at 10:53
  • I looked at this question. There is a completely different problem. But I tried the solutions suggested there. – G.Rizvan Oct 25 '17 at 11:30
  • 1
    even though you added the font to the target while copying, check whether the target is selected in the file inspector section on selecting the font file. – Praveen Kumar Oct 25 '17 at 11:34
  • You mean Bauild Phases / Copy Bundle Resources? Added. I add the font through the code. let attributes = [NSAttributedStringKey.foregroundColor : UIColor.white, NSAttributedStringKey.font: UIFont(name: "BebasNeueRegular", size: 24)] – G.Rizvan Oct 25 '17 at 13:31

2 Answers2

0

After doing some workaround found this:

Imported your custom font -> StoryBoard -> Attributes Inspector Label -> Select Text type = Attribute -> Select your custom fonts.

Please refer below sample image.

enter image description here

Sunil M.
  • 554
  • 5
  • 17
0

The following solution worked for me: https://stackoverflow.com/a/41898069/826435

Once I renamed the "full name" metadata of the font (it's not the same as the file name), it worked. In my case, I just renamed it to "BebasFixNeue." Crazy, but works wonders.

I used a program called FontForge to change the font name. It is free to download.

kgaidis
  • 14,259
  • 4
  • 79
  • 93
  • In 2020, with Xcode 11 and iOS 13, this solution from the same post worked for me. https://stackoverflow.com/a/48927714/3000433 – Mochi Jun 20 '20 at 22:58