本文介绍了UITextView中的Gif动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我看了此问题,但是没有用.我还试图避免这一个>解决方案.最后,我愿意使用 CADisplayLink
并手动更改每个帧.还有,有没有更简单的方法可以做到这一点?
I had a look at this question and it didn't work. I am also trying to avoid this sort of solution. In the end I am willing to go with a CADisplayLink
and change each frame manually. Still, is there a simpler way to do this?
推荐答案
动画gif,如果只是按时间间隔顺序显示的图像集合.您可以使用 UIImageView
这样来做到这一点:
An animated gif if just a collection of images which are displayed in sequence at a timed interval. You can do this with a UIImageView
like this:
imageView.animationImages = [UIImage(named: "uploadFrame0")!, UIImage(named: "uploadFrame1")!, UIImage(named: "uploadFrame2")!, UIImage(named: "uploadFrame3")!, UIImage(named: "uploadFrame4")!, UIImage(named: "uploadFrame5")!, UIImage(named: "uploadFrame6")!, UIImage(named: "uploadFrame7")!, UIImage(named: "uploadFrame8")!]
imageView.animationDuration = 1
imageView.startAnimating()
然后,您可以使用排除路径来使文本围绕它流动.
Then you can use exclusion paths to make the text flow around it.
这篇关于UITextView中的Gif动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!