4

Here i am using the uiimage-from-animated-gif library to show an animated GIF through a UIImage. It's working, but I need to stop the animation, imageView after one complete revolution.

The following code:

NSURL *url = [[NSBundle mainBundle] URLForResource:@"dove-animate" withExtension:@"gif"];
self.imageView.image = [UIImage animatedImageWithAnimatedGIFData:[NSData dataWithContentsOfURL:url]];

Thanks in advance.

G.P.Reddy
  • 556
  • 3
  • 20
  • 1
    try this http://stackoverflow.com/questions/17864292/uiimageviewanimatedgif-always-loops and http://stackoverflow.com/questions/9744682/display-animated-gif-in-ios – Anbu.Karthik Oct 08 '14 at 08:49

1 Answers1

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
Suresh Thoutam
  • 258
  • 1
  • 7