在 Swift 中,您可以使用 UIFont(name: "DINAlternate-Bold", size: 24)! 来指定 DIN Alternate-Bold 字体。以下代码示例展示了如何使用该字体来显示价格:

attributedString.append(NSAttributedString(string: String(format: "%.2f", price), attributes: [.font: UIFont(name: "DINAlternate-Bold", size: 24)!, .foregroundColor: Style.colorRed]))

在使用自定义字体时,请确保字体文件已包含在您的项目中。

Swift: 使用 DIN Alternate-Bold 字体显示价格

原文地址: https://www.cveoy.top/t/topic/nvX9 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录