Xcode 7 iOS9字体不再被识别 [英] Xcode 7 iOS9 font no longer recognized

查看:116
本文介绍了Xcode 7 iOS9字体不再被识别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于iOS 7/8,当以编程方式设置文本参数时,在编译/构建以在设备上运行时,它将按预期显示。但是,当在Xcode 7中测试我的iOS9应用程序时,由于 text.font 没有识别字体,所有我的视图框架都关闭或者根本不可见。它本身不是自定义字体,它位于Apple的库中,事实上,当您通过IB设置标签时它会正确显示,但在代码中执行相同操作时,它只显示系统字体。任何想法如何规避这个问题?它在iOS9中创建了一个非常丑陋的视图,但一切仍然正常显示< = iOS8。

For iOS 7/8 when setting a text's parameters programmatically, it would display as expected when compiled/built to run on device. However, when testing my app for iOS9 in Xcode 7 all my views' frames are off or just plain not visible due to the text.font not recognizing the font. It's not a custom font per se, it's in Apple's library, and in fact, when you set a label via IB it displays properly, but when doing the same thing in code it simply displays the system font. Any ideas how to circumvent this issue? It's creating quite an ugly view in iOS9 but everything still displays properly <=iOS8.

有问题的字体是Heiti TC Light

The font in question is "Heiti TC Light"

我从Apple的字体书中获得了帖子脚本名称并相应地应用它:

I got the post script name from Apple's Font Book and apply it accordingly:

@"STHeitiTC-Light"

再次适用于iOS9以外的所有iOS版本

Again, works in all iOS versions except iOS9

使用Xcode 7.0 beta 3 | iOS 9模拟器

Using Xcode 7.0 beta 3 | iOS 9 simulator

推荐答案

似乎Apple已经在Xcode构建中得出了对这种特定字体的支持。它仅显示在IB中,因为它是从之前的Xcode版本缓存并通过升级保留的。

It seems Apple has concluded support for this specific font in the Xcode build. It only displayed in the IB because it was cached from the previous Xcode version and retained through the upgrade.

对于与其字体存在同样问题的用户,它仍然可能是有效的操作系统字体,但他们可能已将其从Xcode中删除。我建议通过更改新项目的IB中的字体来启动一个新项目以查看您的字体是否仍然是受支持的字体,如果未列出,则必须将font.ttc从Font Book复制到项目并包含它在您的info.plist中像其他自定义字体一样。

For users with this same issue with their font, it still may be a valid OS font, but they may have removed it from Xcode. I would suggest starting a new project to see if your font is still a supported font by changing the font in IB of the new project, if it's not listed you will have to copy the font.ttc from Font Book to the project and include it in your info.plist like other custom fonts.

这篇关于Xcode 7 iOS9字体不再被识别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆