简体   繁体   English

在Xcode 6 / iOS 8界面生成器启动屏幕上使用自定义字体

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

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 .xib file in my project. 我通过选择New File,Launch Screen创建了一个新的界面构建器文件,它在我的项目中创建了一个.xib文件。

启动屏幕创建

I then designed my launch screen, and everything works great, except: I have a custom font, which I've assigned to a UILabel in Interface Builder. 然后我设计了我的启动屏幕,一切都很好,除了:我有一个自定义字体,我已经分配给Interface Builder中的UILabel The font appropriately appears in Interface Builder, but when the .xib is used to generate launch images, the system font is used. 字体恰当地出现在Interface Builder中,但是当.xib用于生成启动图像时,将使用系统字体。

Any ideas? 有任何想法吗?

Update 2014-09-16 更新2014-09-16

I learned something on Twitter from @flo_muc that might be relevant: 我在Twitter上从@flo_muc那里学到了一些可能相关的东西:

“TIL: iOS 8 has it's own deamon for displaying xib based launch images called splashboardd. “TIL:iOS 8拥有自己的deamon,用于显示基于xib的启动图像,名为splashboardd。 So this xib is running outside of your scope.” 所以这个xib在你的范围之外运行。“

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 似乎是一个错误......当我使用属性String时,只会出现此错误

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 Membership in the File Inspector. 我缺少的关键步骤是步骤#2:单击Project Navigator中的每个字体,并在File Inspector中的Target Membership下选中项目框。

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: 在我的情况下,它与大小类有关,我可以通过删除大小类自定义快速修复它:

在此输入图像描述

I've also encounter the same bug. 我也遇到了同样的错误。 My fixes is to use an image... 我的修复是使用图像......

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM