Reputation: 69
i have one gif image file having 4 images , i like to display these images in UIImage view one by one line image.animation . please guide is it possible to display or shoul i use alternat tell me .
thank you .
Upvotes: 1
Views: 11786
Reputation: 1659
FLAnimatedImage is a performant open source animated GIF engine for iOS:
It's a well-tested component that I wrote to power all GIFs in Flipboard.
Upvotes: 3
Reputation: 2283
First of all you can add those 4 images in one Plist and do the following code. I hope it will work
NSDictionary *picturesDictionary = [NSDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"PhotesArray" ofType:@"plist"]];
NSArray *imageNames = [picturesDictionary objectForKey:@"Photos"];
NSMutableArray *images = [[NSMutableArray alloc] init];
for (int i=0; i<[imageNames count]; i++) {
[images addObject:[UIImage imageNamed:[imageNames objectAtIndex:i]]];
}
//Normal animation
self.dataImageView.animationImages = images;
self.dataImageView.animationDuration = 3.0;
[self.dataImageView startAnimating];
Upvotes: 0
Reputation: 84
it will help you , for gif link..https://github.com/mayoff/uiimage-from-animated-gif more help please feel free to ask
Upvotes: 1
Reputation: 1331
Try like this...
- (void)viewDidLoad {
[super viewDidLoad];
NSURL *url = [[NSBundle mainBundle] URLForResource:@"loading" withExtension:@"gif"];
UIImage *loadingImage = [UIImage animatedImageWithAnimatedGIFData:[NSData dataWithContentsOfURL:url]];
self.dataImageView.animationImages = loadingImage.images;
self.dataImageView.animationDuration = loadingImage.duration;
self.dataImageView.animationRepeatCount = 1;
self.dataImageView.image = loadingImage.images.lastObject;
[self.dataImageView startAnimating];
}
Upvotes: 0
Reputation: 1522
yes it possible in iOS,here i enclosed one URL below.please refer this for your concept,even i did it with help of this link.
https://github.com/mayoff/uiimage-from-animated-gif
hope i held you.
Upvotes: 0