在 Xcode 6 / iOS 8 Interface Builder Launch Screen 中使用自定义字体

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25794314/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 02:22:48  来源:igfitidea点击:

Using custom fonts with Xcode 6 / iOS 8 Interface Builder Launch Screen

iosxcodefontsinterface-builderuilabel

提问by Tim Camber

I'm using Xcode 6's new interface builder-based launch images, and am running into an issue.

我正在使用 Xcode 6 的新的基于界面构建器的启动图像,并且遇到了一个问题。

I created a new interface builder file by selecting New File, Launch Screen, which created a .xibfile in my project.

我通过选择 New File、Launch Screen 创建了一个新的界面构建器文件,这.xib在我的项目中创建了一个文件。

Launch Screen Creation

启动屏幕创建

I then designed my launch screen, and everything works great, except: I have a custom font, which I've assigned to a UILabelin Interface Builder. The font appropriately appears in Interface Builder, but when the .xibis used to generate launch images, the system font is used.

然后我设计了我的启动屏幕,一切都很好,除了:我有一个自定义字体,我已将它分配给UILabelInterface Builder 中的一个。该字体适当地出现在 Interface Builder 中,但是当.xib用于生成启动图像时,将使用系统字体。

Any ideas?

有任何想法吗?

Update 2014-09-16

更新 2014-09-16

I learned something on Twitter from @flo_mucthat might be relevant:

我在 Twitter 上从@flo_muc学到了一些可能相关的东西:

“TIL: iOS 8 has it's own deamon for displaying xib based launch images called splashboardd. So this xib is running outside of your scope.”

“TIL:iOS 8 有自己的守护进程,用于显示基于 xib 的启动图像,称为 splashboardd。所以这个xib超出了你的范围。”

回答by Sn0wfreeze

Did you actually added it to the plist File?

你真的把它添加到 plist 文件中了吗?

Here's a short introduction how to do this: http://codewithchris.com/common-mistakes-with-adding-custom-fonts-to-your-ios-app/

这是如何做到这一点的简短介绍:http: //codewithchris.com/common-mistakes-with-adding-custom-fonts-to-your-ios-app/

Greetings, Alex

问候,亚历克斯

EDIT: Actually I tried to add my own fonts to my with the interface Builder and it doesn't work. Seems to be a bug... This bug only appears, when I use an attributed String

编辑:实际上我尝试使用界面生成器将我自己的字体添加到我的中,但它不起作用。似乎是一个错误......这个错误只在我使用属性字符串时出现

回答by Chloe Unrau

I found a solution that works for me. I was having the same problem you've described, and I came across this helpful page:

我找到了一个适合我的解决方案。我遇到了你描述的同样问题,我遇到了这个有用的页面:

http://codewithchris.com/common-mistakes-with-adding-custom-fonts-to-your-ios-app/

http://codewithchris.com/common-mistakes-with-adding-custom-fonts-to-your-ios-app/

The key step that I was missing was step #2: Click on each of your fonts in the Project Navigator, and check the box for your project under Target Membershipin the File Inspector.

我遗漏的关键步骤是第 2 步:在 Project Navigator 中单击您的每种字体,然后在 File Inspector 中的Target Membership下选中您的项目框。

回答by Performat

I faced the same problem, even after double checking all the steps described in the really good cheat sheet provided by codewithchris.

我遇到了同样的问题,即使仔细检查了codewithchris提供的非常好的备忘单中描述的所有步骤。

In my case it was related to the size classes and I could quickly fix it by deleting the size classes customization:

就我而言,它与尺寸等级有关,我可以通过删除尺寸等级自定义来快速修复它:

enter image description here

在此处输入图片说明

回答by imcc

I've also encounter the same bug. My fixes is to use an image...

我也遇到了同样的错误。我的修复方法是使用图像...