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