This project defines a category
UIImage. The category defines two methods. This method creates an animated
UIImage using the frames of the GIF in
+[UIImage animatedImageWithAnimatedGIFData:(NSData *)data]
This method creates an animated
UIImage using the frames of the GIF loaded from
+[UIImage animatedImageWithAnimatedGIFURL:(NSURL *)url]
Look at the comments in
UIImage+animatedGIF.h for details.
You can build and run the project to see a trivial demo app.
To use this category in your own project
UIImage+animatedGIF.mto your project.
UIImage+animatedGIF.mto your target's “Compile Sources” build phase, if you didn't tell Xcode to do that when you performed step 1.
ImageIO.frameworkto your target's "Link Binary With Libraries" build phase.
The implementation of this category uses the Image I/O Framework to extract the images and durations from the GIF data.
Diego Peinador provided the inspiration for handling variable-frame-rate animations, although I didn't end up using his code.
Copyright or lack thereof
The contents of this repository are dedicated to the public domain, in accordance with the CC0 1.0 Universal Public Domain Dedication, which is reproduced in the file
Author: Rob Mayoff 2012-01-27