xcode 使用 UILabel 的属性字符串设置在 Interface Builder 中显示自定义字体

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20809329/
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-09-15 04:28:28  来源:igfitidea点击:

Show custom fonts in Interface Builder with UILabel's attributed string setting

iosxcodefontsinterface-builder

提问by wprater

When I use the UILabel's attributed setting in Xcode 5's Interface Builder, it will show a preview on the storyboard for built-in fonts like American Typewriter. When I try to use it with a custom font, it only shows it in the preview area, not on the storyboard.

当我在 Xcode 5 的 Interface Builder 中使用 UILabel 的属性设置时,它将在情节提要上显示内置字体(如 American Typewriter)的预览。当我尝试将它与自定义字体一起使用时,它只显示在预览区域中,而不显示在故事板上。

Is it possible to show the preview in the storyboard with custom fonts?

是否可以使用自定义字体在故事板中显示预览?

Here are some screen shot examples:

以下是一些屏幕截图示例:

You can see that 'FOOBAR' shows the custom font in the inspector

您可以看到“FOOBAR”在检查器中显示了自定义字体

inspector

检查员

But not on the storyboard

但不在故事板上

storyboard

故事板

回答by antonkronaj

In Xcode 6 you need to select, highlight, the preview text in interface builder. Then change the fonts. You then will see it.

在 Xcode 6 中,您需要在界面构建器中选择、突出显示预览文本。然后改变字体。然后你会看到它。

enter image description here

在此处输入图片说明