问题描述
UIFont
有获取常规字体( systemFontOfSize
)或粗体字( boldSystemFontOfSize)的方法
),但如何通过故事板获得瘦系统字体?
UIFont
has methods to get regular font (systemFontOfSize
) or bold font (boldSystemFontOfSize
), but how to get a "thin system font" available through storyboard?
将system-thin传递给 UIFont
Contructor不起作用,此构造函数仅适用于非系统字体。
Passing "system-thin" to UIFont
Contructor doesn't work, this constructor only works for non system fonts.
推荐答案
您可以使用系统字体瘦身:
You can use system font thin weight:
UIFont.systemFont(ofSize: 34, weight: UIFontWeightThin)
列表旧金山的可用重量:
List of available weights for San Francisco:
UIFontWeightUltraLight
UIFontWeightThin
UIFontWeightLight
UIFontWeightRegular
UIFontWeightMedium
UIFontWeightSemibold
UIFontWeightBold
UIFontWeightHeavy
UIFontWeightBlack
截至iOS 11, UIFontWeight *
已重命名为 UIFont.Weight。*
。您可以访问。
As of iOS 11, UIFontWeight*
was renamed to UIFont.Weight.*
. More you can get here https://developer.apple.com/documentation/uikit/uifont.weight.
这篇关于UIFont - 如何获得系统瘦字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!