首页 > 解决方案 > 无法在 Swift 5 中以编程方式使用“Times New Roman Bold”

问题描述

我正在尝试在运行时使用 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

标签: ios13swift5xcode11

解决方案


我在这里找到了答案 - iOS 字体

但感谢Rup的帮助。

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


推荐阅读