【问题标题】:Can't use "Times New Roman Bold" programmatically in Swift 5无法在 Swift 5 中以编程方式使用“Times New Roman Bold”
【发布时间】:2020-04-22 12:50:28
【问题描述】:

我正在尝试在运行时使用 UIFont(name: "Times New Roman Bold", size: 30.0) 但它正在返回 nil

这是我的代码 -

lblHeader.font = UIFont(name: "Times New Roman Bold", size: 30.0)

但是当我在控制台打印时,lblHeader 正在返回 SFUI-Regular

我尝试了以下组合但没有运气 -

Times New Roman Bold

Times New Roman-Bold

Times New Roman-bold

Times New Roman bold

TimesNewRoman Bold

TimesNewRoman-Bold

【问题讨论】:

  • iosfonts.com 将其命名为“TimesNewRomanPS-BoldMT”,但我不知道这是否是正确的标识符。
  • @Rup 是的,它正在工作。我在这里得到了所有 iOS 字体名称 - gist.github.com/tadija/cb4ec0cbf0a89886d488d1d8b595d0e9
  • @Rup 发布您的答案,以便其他人可以从您的答案中获得帮助。
  • 谢谢,但你的要点更好。将其发布为您自己的答案?

标签: ios13 swift5 xcode11


【解决方案1】:

我在这里找到了答案 - iOS Fonts

但感谢Rup 的帮助。

我希望这个答案对其他人有所帮助。 快乐编码:)

【讨论】:

    猜你喜欢
    • 2020-02-01
    • 1970-01-01
    • 2012-11-24
    • 2022-11-01
    • 1970-01-01
    • 2016-10-17
    • 1970-01-01
    • 1970-01-01
    • 2013-02-10
    相关资源
    最近更新 更多