简体   繁体   English

XCode:未应用自定义字体

[英]XCode: custom font is not applied

I'm trying to add the custom font to my application.我正在尝试将自定义字体添加到我的应用程序中。 I've already tried to follow all standard recommendations from the documentation and the rest of articles related to the problem.我已经尝试遵循文档中的所有标准建议以及与该问题相关的文章 rest。

What I've done:我做了什么:

As a result font is visible in Attribute Inspector and successfully changed in the LaunchScreen storyboard.结果字体在属性检查器中可见,并在 LaunchScreen storyboard 中成功更改。 But when I run app in simulator only size and colour are applied but not font-face.但是当我在模拟器中运行应用程序时,只应用大小和颜色,而不应用字体。

I'm using XCode 12.2 (12B45b) in Big Sur.我在大苏尔使用 XCode 12.2 (12B45b)。

What else should I try?我还应该尝试什么? Thank you in advance.先感谢您。

In the case that the problem is only for LaunchScreen , you can't use custom fonts on the LaunchScreen .如果问题仅针对LaunchScreen ,则不能在 LaunchScreen 上使用自定义LaunchScreen System will automatically replace your custom font to system font during runtime.系统会在运行时自动将您的自定义字体替换为系统字体。

A quick workaround is to use an UIImageView and have your text as UIImage on it, literally a picture of your text as .png / .jpeg or similar.一个快速的解决方法是使用UIImageView并将您的文本作为UIImage ,字面意思是您的文本图片为.png / .jpeg或类似文件。

Note : It may take some time before you can see the image, sometimes you had to clean the Build Folder and reinstall the app a couple of times in order to see the image.注意:您可能需要一些时间才能看到图像,有时您必须清理构建文件夹并重新安装应用程序几次才能看到图像。

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

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