首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >swift tablecell NSTextAttachment + GIF -> gif图像未设置动画

swift tablecell NSTextAttachment + GIF -> gif图像未设置动画
EN

Stack Overflow用户
提问于 2020-06-15 16:08:23
回答 1查看 123关注 0票数 0

我正在尝试将gif图像添加到表格单元格+文本属性,我在nstext附件上工作,以正常显示gif图像,gif图像显示,但它没有动画。有没有人给我解释一下问题?

代码语言:javascript
复制
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)

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-10-04 04:35:17

Gif图像将不能与NSTextAttachment一起工作。您可以对.gif图像使用UIImageView。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62383968

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档