无法在 Swift 中以编程方式使用 "Times New Roman Bold" 5

Can't use "Times New Roman Bold" programmatically in Swift 5

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

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

但感谢Rup的帮助。

希望这个回答能对其他人有所帮助。 编码愉快:)