Xcode custom fonts not showing up in Storyboard

白昼怎懂夜的黑 提交于 2020-12-29 05:12:39

问题


I added my two fonts to my project folder:

I added them to info.plist:

I can not see them in my custom font list in the storyboard:

What have i done wrong?


回答1:


I know this is a pretty old question, but I ran into the same issue. And the above tips didn't work for me. Apart from the standard checks (present in bundle, restarting XCode, the thing that fixed my issue was that my label text type was marked as "Plain" and hence some fonts were not showing in the dropdown in the Storyboard. As soon as I changed the text type to "Attributed", all the fonts appeared in the dropdown.

Hope this'll help someone stuck with the same issue.




回答2:


This drop-down box shows the system-wide installed fonts. So you need to install your custom font on your system first so it's appearing in that drop-down box. You can do that by double-clicking it, the FontBook.app opens and asks you whether you want to install the font.




回答3:


Had the same problem but this SO answer by user Saranjith solved it while the other solutions in this thread didn't: Xcode 8 custom font doesn't show up in interface builder

Basically in Font Book select "Computer Fonts" and then hit the + button and re add the Fonts.

This is happened to me after moving to Xcode 11 in Catalina from Xcode 10 in Mojave.




回答4:


I Installed the font in the system as per DarkDust solution and i am able to see the font in attributed type.

Then i changed the type to plain and i able to see the Custom font in the font types drop down.




回答5:


I solved my problem when i used font name. Do not use file name. I was used like this [UIFont fontWithName:@"appFont" size:17] but it is wrong.

  1. Upload your font file to https://fontdrop.info/ and use the name
  2. My font file name is appFont.ttf but when i uploaded i saw Roboto Regular.
  3. [UIFont fontWithName:@"Roboto Regular" size:17]



回答6:


This was a huge headache for me but I simply fixed it by: I fixed the issue by restarting my Mac. Then restarting Xcode.




回答7:


Well, silly mistake on my part, but I didn't realize my font was named something way different from the file name.

Double-clicking the actual font file opened it in the font book, and that showed the actual font name. It was in the dropdown all along.




回答8:


Sometime I go to another file and come back, then my custom fonts are arrived. I think this is an issue of Xcode and will be solved in following version.




回答9:


If Xcode showed your custom font before but stopped to do it at some moment, try to readd font files to your project. It solved the problem for me. Other answers weren't helpful.



来源:https://stackoverflow.com/questions/32755428/xcode-custom-fonts-not-showing-up-in-storyboard

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!