在这里,我正在使用uiimage-from-animated-gif库通过UIImage
显示动画GIF。它正在工作,但是在一整圈后我需要停止动画imageView
。
如下代码:
NSURL *url = [[NSBundle mainBundle] URLForResource:@"dove-animate" withExtension:@"gif"];
self.imageView.image = [UIImage animatedImageWithAnimatedGIFData:[NSData dataWithContentsOfURL:url]];
提前致谢。
最佳答案
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