【问题标题】:Stopping the animation of GIF停止 GIF 的动画
【发布时间】:2014-12-02 20:08:23
【问题描述】:
这里我使用uiimage-from-animated-gif 库通过UIImage 显示动画GIF。它正在工作,但我需要在完全旋转一圈后停止动画,imageView。
以下代码:
NSURL *url = [[NSBundle mainBundle] URLForResource:@"dove-animate" withExtension:@"gif"];
self.imageView.image = [UIImage animatedImageWithAnimatedGIFData:[NSData dataWithContentsOfURL:url]];
提前致谢。
【问题讨论】:
标签:
ios
objective-c
iphone
cocoa-touch
ios8
【解决方案1】:
url = [[NSBundle mainBundle] URLForResource:@"dove-animate" withExtension:@"gif"];
UIImage *testImage = [UIImage animatedImageWithAnimatedGIFData:[NSData dataWithContentsOfURL:url]];
self.imageView.image = [UIImage animatedImageWithAnimatedGIFData:[NSData dataWithContentsOfURL:url]];
self.imageView.animationImages = testImage.images;
self.imageView.animationDuration = testImage.duration;
self.imageView.animationRepeatCount = 1;
self.imageView.image = testImage.images.lastObject;
[self.imageView startAnimating];
Use the above code it will works