如何在 Xcode 中添加缺少的 San Francisco 字体?

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

How to add missing San Francisco font inside Xcode?

iosxcodefonts

提问by Adrian

I am running Xcode 8.3 , but I don't seem to have the San Francisco font present.

我正在运行 Xcode 8.3 ,但似乎没有 San Francisco 字体。

I already download it from https://developer.apple.com/fonts/and install it. I can see it when I open Font Book on my mac.

我已经从https://developer.apple.com/fonts/下载并安装它。当我在 Mac 上打开 Font Book 时,我可以看到它。

Are there any additional steps to add the font inside Xcode ?

是否有任何其他步骤可以在 Xcode 中添加字体?

edit: I am designing my app in Interface Builder so I need to have the font in Xcode to see how it looks when I run it.

编辑:我正在 Interface Builder 中设计我的应用程序,所以我需要在 Xcode 中使用字体来查看它在我运行时的外观。

回答by Luzo

Yes, you need to include it in your plist. There should be a plenty of threads with that. Thismight help you

是的,您需要将它包含在您的 plist 中。应该有很多线程。可能会帮助你

回答by Sam Ngugi

If you are targeting iOS 9 or later San Francisco is the default font. Usage in swift 3 UIFont.systemFont(ofSize: 15)

如果您的目标是 iOS 9 或更高版本 San Francisco 是默认字体。在 swift 3 中的使用UIFont.systemFont(ofSize: 15)

回答by ArdentLearner

Had a similar issue for an ios application built with React native. Using react-native linkdid not resolve my issue. The font assets where in the Resourcesfolder and in Build Phases > Copy Bundle Resourcesyet the issue persisted. It was only resolved after I added the relative path to the actual fonts assets in my case ../lib/assets/fontsto my plist under Application fonts resource path

使用 React Native 构建的 ios 应用程序也有类似的问题。使用react-native link并没有解决我的问题。Resources文件夹中的字体资产和Build Phases > Copy Bundle Resources问题仍然存在。只有在我将我的案例中实际字体资产的相对路径添加../lib/assets/fonts到我的 plist 下后才解决Application fonts resource path

An image of the relecvant section of my Info.plist

我的 Info.plist 的相关部分的图像

Don't forget about: Build Phases > Copy Bundle Resources

不要忘记: Build Phases > Copy Bundle Resources