1

I don't know what I'm doing wrong, but I'm trying to use plain text in a UILabel using storyboard to have a custom font. I can only see the fonts when I'm switching the text style from Plain text to Attributed.

The steps I have done to install them:

  1. Dragged fonts into the project (.ttf)
  2. Checked that the fonts are included as resources in my bundle
  3. Include the fonts in my plist under Fonts provided by application-key

But the only way I can use my custom font is by setting the text to attributed. In my older projects, I have done the same procedure as above and been able to just change the font without having to put the UILabels to have attributed strings in storyboards.

Any clue on how I can manage this?

Edit

When I'm using this following code below, I'm not seeing my custom font.

for family: String in UIFont.familyNames {
    print(family)
    for names: String in UIFont.fontNames(forFamilyName: family) {
        print("== \(names)")
    }
}
Community
  • 1
  • 1
Jacob Ahlberg
  • 2,352
  • 6
  • 22
  • 44

1 Answers1

1

With your demo project I have only add

lbl.font = UIFont(name:"Seravek",size:15)

in viewWillAppear and it's showing fine.

Dharmesh Kheni
  • 71,228
  • 33
  • 160
  • 165
  • Is it possible to show the font in storyboard when setting font on a `UILabel`? – Jacob Ahlberg Feb 20 '19 at 07:58
  • 1
    Its already answered here. https://stackoverflow.com/questions/3398693/fonts-not-displaying-in-interface-builder And I am facing same issue – Dharmesh Kheni Feb 20 '19 at 08:00
  • Funny fact. I set the custom font when the UILabel was using attributed text, and then I just switched back to plain text to keep the font. Hahaha... – Jacob Ahlberg Feb 20 '19 at 08:22