如何在 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
How to add missing San Francisco font inside Xcode?
提问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
回答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 link
did not resolve my issue. The font assets where in the Resources
folder and in Build Phases > Copy Bundle Resources
yet the issue persisted. It was only resolved after I added the relative path to the actual fonts assets in my case ../lib/assets/fonts
to 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
Don't forget about: Build Phases > Copy Bundle Resources
不要忘记: Build Phases > Copy Bundle Resources