swift tablecell NSTextAttachment + GIF -> gif 图像不是动画

swift tablecell NSTextAttachment + GIF -> gif image not animate

我尝试将 gif 图像添加到 table 单元格 + 文本属性,我在 nstextattachment 上工作以正常显示 gif 图像,gif 图像显示但它没有动画。有人向我解释了问题吗?

let attachment = NSTextAttachment()
attachment.image = UIImage.gif(name: data.Data)
attachment.bounds = CGRect(x: 0, y: (font.capHeight - gifSize).rounded() / 2, width: gifSize, height: gifSize)
let replacement = NSAttributedString(attachment: attachment)
attributedString.replaceCharacters(in: aMatch.range, with: replacement)

Gif 图像不适用于 NSTextAttachment。您可以将 UIImageView 用于 .gif 图片。