-1

into my app I need to display gif image on my view, but don't use the UIWebview to display it. So have any way to do it? Thanks in advance!

lee
  • 7,955
  • 8
  • 44
  • 60

2 Answers2

2

check out this

https://github.com/mayoff/uiimage-from-animated-gif

It provides the following category:

+[UIImage animatedImageWithAnimatedGIFURL:(NSURL *)url]

allowing you to simply:

#import "UIImage+animatedGIF.h"
UIImage* mygif = [UIImage animatedImageWithAnimatedGIFURL:[NSURL URLWithString:@"http://en.wikipedia.org/wiki/File:Rotating_earth_(large).gif"]];
Sumit Mundra
  • 3,891
  • 16
  • 29
2

You Can Use this project from gothub https://github.com/mayoff/uiimage-from-animated-gif

Example

NSURL *url = [[NSBundle mainBundle] URLForResource:@"test" withExtension:@"gif"];
self.dataImageView.image = [UIImage animatedImageWithAnimatedGIFData:[NSData dataWithContentsOfURL:url]];
self.urlImageView.image = [UIImage animatedImageWithAnimatedGIFURL:url];

url = [[NSBundle mainBundle] URLForResource:@"variableDuration" withExtension:@"gif"];
self.variableDurationImageView.image = [UIImage animatedImageWithAnimatedGIFURL:url];
BHASKAR
  • 1,201
  • 1
  • 9
  • 20
  • up vote for good link, So just have only answer is accept so this is must the earlier answer.Thanks for your help. – lee Aug 14 '14 at 09:13