Xcode font disappeared

2020-08-12 09:15发布

I imported my fonts on my project (Roboto), it worked with my first ViewController, but now Roboto disappeared of my Custom Fonts. Now when I want to modify my font, the font changed to Helvetica.

I don't understand how it happened, I didn't change the fonts folder.

3条回答
时光不老,我们不散
2楼-- · 2020-08-12 09:45

Try to use the custom font on one of your UILabel through the storyboard, after that search for the custom font programatically:

for family: String in UIFont.familyNames
        {
            print("\(family)")
            for names: String in UIFont.fontNames(forFamilyName: family)
            {
                print("== \(names)")
            }
        }

You should be able to see the font you are looking for

查看更多
Explosion°爆炸
3楼-- · 2020-08-12 09:51

No need to reinstall the font, since it's already added to the project. Just quit Xcode and delete DerivedData then start Xcode again. The custom font should be ok. I delete the whole DerivedData folder, since Xcode will generate it automatically.

rm -rf ~/Library/Developer/Xcode/DerivedData

查看更多
相关推荐>>
4楼-- · 2020-08-12 09:58

I had the same problem, also using Roboto. After restarting Xcode the font reappeared.

查看更多
登录 后发表回答