目前,在 XCode 11 beta 中它无法正常工作,但您可以遵循一种解决方法。将文本样式从普通更改为属性。这允许您更改字体。
如果您不想在 Mac 上安装字体,也可以在 xib 的 XML 中进行设置:
在 <document>
标签内添加以下内容。通常位于 </dependencies>
标签下方。
<customFonts key="customFonts">
<array key="Roboto-Medium.ttf">
<string>Roboto-Medium</string>
</array>
<array key="Roboto-Regular.ttf">
<string>Roboto-Regular</string>
</array>
</customFonts>
更改为您的自定义字体。
在 <label>
标签内:
<fontDescription key="fontDescription" name="Roboto-Medium" family="Roboto" pointSize="18"/>
你应该看到类似于:
升级到Xcode 11 Beta 5。这对我解决了问题。