【问题标题】:Using styles of the iOS system font other than Regular in code在代码中使用除Regular以外的iOS系统字体样式
【发布时间】:2015-09-17 12:15:16
【问题描述】:

目前我知道我可以使用[UIFont systemFontOfSize:15] 将UILabel 的字体设置为系统字体。但是如何以编程方式检索系统字体的中等样式?似乎只看到了一种方法与要应用的字体的常规样式。

目前我似乎只能在 IB 中使用这些字体:

【问题讨论】:

  • 字体的“中”和“常规”版本是什么意思?请说明您要做什么。

标签: ios cocoa-touch fonts uifont


【解决方案1】:

您可以将+systemFontOfSize:weight: 与 UIFontDescriptor 中的font weight constants 之一结合使用。

或者,也许更合适的是preferredFontForTextStyle:,它尊重用户的设置。

【讨论】:

    猜你喜欢
    • 2018-07-30
    • 1970-01-01
    • 1970-01-01
    • 2020-01-19
    • 2017-09-17
    • 1970-01-01
    • 1970-01-01
    • 2022-08-18
    • 2015-12-17
    相关资源
    最近更新 更多