在 iOS 14 中获取 strokeWidth NSAttributedString 问题

vik*_*ati 10 nsmutablestring ios swift ios13 ios14

我在 iOS 14 上遇到笔触颜色问题。

let attributes: [NSAttributedString.Key: Any] = [
    .foregroundColor: UIColor.white,
    .strokeColor: UIColor.black,
    .font: UIFont.systemFont(ofSize: 65, weight: .black),
    .strokeWidth: -1 
]
lableNumber.attributedText =  NSAttributedString(string: "2", attributes: attributes)
Run Code Online (Sandbox Code Playgroud)

iOS 13

在此处输入图片说明

iOS 14

例子

它适用于 iOS 13,但不适用于 iOS 14。谁能帮我解决这个问题?

Ger*_*eon 4

看起来 Apple 已经更改了 iOS 14 中的字体轮廓,6 和 9 的字形也呈现出类似的痕迹。我会向 Apple 提交错误。

根据您的要求,使用UIFont.monospacedSystemFont(...)可以工作,这些字形对我来说仍然看起来不错。(编辑:“1”在等宽版本中也有工件。也许可以使用UIFont(name: "HelveticaNeue-Bold", size: 65)?)

  • 我已经为您提交了该错误。FB8795082 (3认同)