简体   繁体   English

swift tablecell NSTextAttachment + GIF -> gif 图像没有动画

[英]swift tablecell NSTextAttachment + GIF -> gif image not animate

im try to add gif image to table cell + text attribute, i worked on nstextattachment to show gif image normally, the gif image showed but it does not animate.我尝试将 gif 图像添加到表格单元格 + 文本属性,我在 nstextattachment 上工作以正常显示 gif 图像,gif 图像显示但它没有动画。 did someone explain me the problem?有人向我解释了这个问题吗?

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 image will not work with NSTextAttachment. Gif 图像不适用于 NSTextAttachment。 You can use UIImageView for.gif images.您可以将 UIImageView 用于 .gif 图像。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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