gpt4 book ai didi

ios - UIFont - 如何获取系统细字体

转载 作者:行者123 更新时间:2023-11-30 13:44:03 26 4
gpt4 key购买 nike

UIFont 有方法获取常规字体 (systemFontOfSize) 或粗体字体 (boldSystemFontOfSize),但是如何获取“细系统字体” “可以通过 Storyboard获得吗?

将“system-thin”传递给UIFont构造函数不起作用,此构造函数仅适用于非系统字体。

最佳答案

您可以使用系统字体细重:

UIFont.systemFont(ofSize: 34, weight: UIFontWeightThin)

旧金山可用权重列表:

UIFontWeightUltraLight
UIFontWeightThin
UIFontWeightLight
UIFontWeightRegular
UIFontWeightMedium
UIFontWeightSemibold
UIFontWeightBold
UIFontWeightHeavy
UIFontWeightBlack

san francisco font weights

自 iOS 11 起, UIFontWeight* 已重命名为 UIFont.Weight.*。您可以在此处获取更多信息 https://developer.apple.com/documentation/uikit/uifont.weight .

关于ios - UIFont - 如何获取系统细字体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35190963/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com