简体   繁体   中英

Getting issue on strokeWidth NSAttributedString in 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

例子

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

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM