我正在尝试将gif图像添加到表格单元格+文本属性,我在nstext附件上工作,以正常显示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)

发布于 2020-10-04 04:35:17
Gif图像将不能与NSTextAttachment一起工作。您可以对.gif图像使用UIImageView。
https://stackoverflow.com/questions/62383968
复制相似问题