在iOS 14中获取strokeWidth NSAttributedString的问题 [英] Getting issue on strokeWidth NSAttributedString in iOS 14

查看:79
本文介绍了在iOS 14中获取strokeWidth NSAttributedString的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在iOS 14上的笔触颜色有问题.

I have an issue with stroke color on 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

iOS 14

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

It is working on iOS 13 but not working in iOS 14. Can anyone help me to resolve this issue?

推荐答案

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

Looks like Apple has changed the font outlines in iOS 14, the glyphs for 6 and 9 exhibit similar artifacts. I would file a bug with Apple.

根据您的要求,使用 UIFont.monospacedSystemFont(...)可能有效,这些字形在我看来仍然可以.("1"在等距版本中也有伪像.也许使用 UIFont(名称:"HelveticaNeue-Bold",大小:65)?)

Depending on your requirements, using UIFont.monospacedSystemFont(...) could work, those glyphs still look OK to me. ( "1" has artifacts in the monospaced version as well. Maybe use UIFont(name: "HelveticaNeue-Bold", size: 65) instead?)

这篇关于在iOS 14中获取strokeWidth NSAttributedString的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆