OGeek|极客世界-中国程序员成长平台

标题: ios - UIButton 属性标题上的系统字体消失 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-11 19:41
标题: ios - UIButton 属性标题上的系统字体消失

我有一个 UIButton,我将其标题更改为 attributed

既然标题已归属,我需要保留字体 - “系统字体”。

很遗憾,我找不到系统字体,因为当我将 UIButton 标题设置为属性时,我无法再获得此菜单:

the good menu

相反,我只得到这个菜单:

bad menu

在这里,在较大的菜单中,我找不到系统字体。

菜单中的系统字体在哪里,或者在使用 UIButton 属性标题时如何通过界面生成器添加系统字体?

请不要建议“在 UIButton 下添加带有 _______ 的标签”或“带有文本的 UIImageView”。



Best Answer-推荐答案


当前iOS系统字体为“旧金山”

您可以通过以下方式使用它:

UIFont.systemFont(ofSize: CGFloat, weight: UIFontWeight)

您也可以通过此页面上的链接下载字体:https://developer.apple.com/ios/human-interface-guidelines/visual-design/typography/

关于ios - UIButton 属性标题上的系统字体消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48523250/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4