Xcode 9 custom fonts not working

后端 未结 5 934
一向
一向 2020-12-19 00:13

Custom fonts not working in Xcode 9. However if I open the same project in Xcode 8, the custom fonts work as expected

I\'ve ran this piece of code to ensure the font

相关标签:
5条回答
  • 2020-12-19 00:40

    I am also using Xcode 9.2 and even I also faced same issues.

    What I did is I directly added the custom font folders inside my app. If you directly add fonts folder then you may face such issues.It will not reflect your font files under Copy Bundle Resources inside Build Phases tab. To solve this problem I used following steps :

    1. First select your font.ttf file inside bundle and on right side under File Inspector check mark the Target Membership option for your project.

    2. Goto project target and under Build Phases goto Copy Bundle Resources and add all your fonts by clicking on + button.(make sure you adding your font.ttf files only not the folder containing that font.ttf file)

    3. Also make sure your file are properly added while dragging them inside your project.Don't forget to check Copy items if needed option. Most important do add the key Fonts provided by application in your info.plist file followed by all the custom fonts you used in your project.

    Hope this helps. Happy coding :)

    0 讨论(0)
  • 2020-12-19 00:41

    It presents a problem for the compiler if it is located inside a blue directory folder (apparently) I moved my font file outside the folder, build and problem solved (GRR!)

    0 讨论(0)
  • 2020-12-19 00:52

    I solved custom font issue in my projects using Xcode 9. Here are the following steps-

    1- Add to the font in the bundle. 2- add in plist file font name under Fonts provided by application 3- Go to Target->build phase and add your font files.

    Now you can run your project.It will show to the custom font in your application.

    0 讨论(0)
  • 2020-12-19 00:57

    I have this issue ,,

    make sure that you Click on your font folder to make sure they are included in your “Target Membership.”

    0 讨论(0)
  • 2020-12-19 00:57

    Had the same problem after opening project in Xcode 9, solved it by reincluding the fonts. (deleted them, cleaned project, included them, built project).

    Altough you got them checked in the target, but not visible to chose as custom font, you can try to specify the localization (above target check) to 'base' or some, it made them visible in Storyboards after that, but unable to load in code (at least in my case). However, reincluding is imo better way to go, it made everything OK.

    0 讨论(0)
提交回复
热议问题