【发布时间】:2018-10-19 05:22:26
【问题描述】:
我使用 SD_WebImage 来显示我的 gif,如下所示:
代码:
UIImage *gifImg = [UIImage sd_animatedGIFWithData:[NSData dataWithContentsOfFile:imagePath]];
NSTextAttachment *atc = [[NSTextAttachment alloc] initWithData:nil ofType:nil];
atc.image = image;
NSAttributedString *textAttachmentString = [NSAttributedString attributedStringWithAttachment:atc];
[emojiText replaceCharactersInRange:range withAttributedString:textAttachmentString];
MyTextView.attributedString = emojiText;
结果: 我的 UITextView 上的图像显示成功,但它不播放,它只是静态的
为什么?我怎样才能激活这个 gif 图像?
(顺便说一句:由于某些原因我不能在我的项目中使用 YYkit,所以我必须使用 UITextView 或 UILabel) 我知道 imageView 可以播放带有图像数组的动画。但我没有找到在 textView 中显示 imageView 的正确方法。
帮帮我~????
【问题讨论】:
-
你可以在这里查看答案。 stackoverflow.com/questions/29949348/…
标签: ios uitextview gif nstextattachment