UIFont
有方法获取常规字体(systemFontOfSize
)或粗体(boldSystemFontOfSize
),但是如何通过情节提要获得可用的“瘦系统字体”?
将“系统精简”传递给UIFont
构造函数不起作用,该构造函数仅适用于非系统字体。
您可以使用系统字体细重:
UIFont.systemFont(ofSize: 34, weight: UIFontWeightThin)
旧金山可用权重列表:
UIFontWeightUltraLight
UIFontWeightThin
UIFontWeightLight
UIFontWeightRegular
UIFontWeightMedium
UIFontWeightSemibold
UIFontWeightBold
UIFontWeightHeavy
UIFontWeightBlack
从 iOS 11 开始, UIFontWeight*
被重命名为UIFont.Weight.*
。更多你可以在这里找到https://developer.apple.com/documentation/uikit/uifont.weight https://developer.apple.com/documentation/uikit/uifont.weight.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)