在iOS 14中获取strokeWidth NSAttributedString的问题

问题描述

我在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)

iOS 13

enter image description here

iOS 14

example

它可以在iOS 13上运行,但不能在iOS 14上运行。有人可以帮助我解决此问题吗?

解决方法

好像Apple已经更改了iOS 14中的字体轮廓,6和9的字形显示出相似的伪像。我会向Apple提交错误。

根据您的要求,使用UIFont.monospacedSystemFont(...)可能有效,这些字形在我看来仍然可以。 (编辑:“ 1”在等距版本中也有伪像。也许使用UIFont(name: "HelveticaNeue-Bold",size: 65)代替?)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...