简体   繁体   English

NSTextAttachment 图像动画可能吗?

[英]Is NSTextAttachment image animation possible?

Using iOS7 I'm able to display images in a UITextView with no problem using NSTextAttachments.使用 iOS7 我能够在 UITextView 中显示图像,使用 NSTextAttachments 没有问题。 However, is it possible to show animated images in a UITextView using NSTextAttachments?但是,是否可以使用 NSTextAttachments 在 UITextView 中显示动画图像? If so, how?如果是这样,如何?

To animate images in NSTextAttachment you need to attach a CADisplayLink to the UITextView and change the images manually.要在 NSTextAttachment 中为图像设置动画,您需要将CADisplayLink附加到UITextView并手动更改图像。 After that you should call layoutManager.invalidateDisplay(forCharacterRange: ATTACHMENT_RANGE) to refresh the textView layout之后你应该调用layoutManager.invalidateDisplay(forCharacterRange: ATTACHMENT_RANGE)来刷新layoutManager.invalidateDisplay(forCharacterRange: ATTACHMENT_RANGE)布局

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

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