[英]Xcode custom fonts not showing up in Storyboard
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.
除了标准检查(存在于捆绑包中,重新启动 XCode,解决我的问题的问题是我的标签文本类型被标记为“普通”,因此一些字体没有显示在情节提要的下拉列表中。我一改变文本类型为“Attributed”,所有字体都出现在下拉列表中。
Hope this'll help someone stuck with the same issue.希望这会帮助遇到同样问题的人。
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.
您可以通过双击它来做到这一点,FontBook.app 会打开并询问您是否要安装字体。
I Installed the font in the system as per DarkDust solution and i am able to see the font in attributed type.我根据 DarkDust 解决方案在系统中安装了字体,我能够看到属性类型的字体。
Then i changed the type to plain and i able to see the Custom font in the font types drop down.然后我将类型更改为纯文本,我可以在字体类型下拉列表中看到自定义字体。
This was a huge headache for me but I simply fixed it by: I fixed the issue by restarting my Mac.这对我来说是一个巨大的头痛,但我只是通过以下方式解决了它:我通过重新启动我的 Mac 解决了这个问题。 Then restarting Xcode.
然后重新启动 Xcode。
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有同样的问题,但用户 Saranjith 的这个 SO 回答解决了这个问题,而这个线程中的其他解决方案没有: Xcode 8 custom font doesn't show 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.这发生在我从 Mojave 的 Xcode 10 迁移到 Catalina 的 Xcode 11 后。
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.
它一直在下拉列表中。
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.
我是这样使用的 [UIFont fontWithName:@"appFont" size:17] 但这是错误的。
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.
我认为这是 Xcode 的问题,将在以下版本中解决。
I ran into the same issue and fixed with below steps我遇到了同样的问题并通过以下步骤修复
If this is not working then restart the Xcode.如果这不起作用,请重新启动 Xcode。
Thanks谢谢
在我的情况下,我只是将文本从plain
文本转换为attributed
,然后将其再次变为plain
文本,然后它就出现了。希望这对任何人都有帮助。
For me it was case sensitive issue with the font file name.对我来说,字体文件名是区分大小写的问题。 Not sure if it's always for this reason...
不知道是不是一直都是这个原因...
In my case my fonts were in woff2
formats.就我而言,我的字体采用
woff2
格式。 Although woff2
is supported in iOS, the fonts don't appear or get rendered in Storyboards.尽管 iOS 支持
woff2
,但字体不会出现或在 Storyboard 中呈现。
If Xcode showed your custom font before but stopped to do it at some moment, try to readd font files to your project.如果 Xcode 之前显示了您的自定义字体,但在某个时刻停止了,请尝试将字体文件读取到您的项目中。 It solved the problem for me.
它为我解决了这个问题。 Other answers weren't helpful.
其他答案没有帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.