Idea: Use uiview animation.
The first step is to split the GIF into one frame (ImageMagick). You can skip this step by using other tools.
First, download the ImageMagick open source project.
URL http: // image_magick.veidrodis.com/image_magick/
Select "14:29:02
13269 K ImageMagick-6.8.5-10.tar.gz.
CD ImageMagick-6.8.5-10/to this directory after, you need three commands, respectively:
./Configure -- prefix =/usr/local/ImageMagick
Make
Sudo make install
(The above installation method reference http://www.lnmp100.com/1027 you can also refer to the official tutorial http://www.imagemagick.org/script/install-source.php#unix)
2. Open the GIF file and run the following command:
Go to the command line: Run Sudu Su to enter the root permission. Run the following command:
/Usr/local/ImageMagick/bin/convert + adjoin xxx.gif outputted d.gif
Third, execute the code
Uiimageview * animatedimageview = [[uiimageview alloc] initwithframe: Self. View. bounds];
Animatedimageview. animationimages = [nsarray arraywithobjects:
[Uiimage imagenamed: @ "image1.gif"],
[Uiimage imagenamed: @ "image2.gif"],
[Uiimage imagenamed: @ "image3.gif"],
[Uiimage imagenamed: @ "image4.gif"], nil];
Animatedimageview. animationduration = 1.0f;
Animatedimageview. animationrepeatcount = 0;
[Animatedimageview startanimating];
[Self. View addsubview: animatedimageview];
The disadvantage of this method is: "You Need To Know the frame and frame frequency of the GIF image in advance." Of course, the most perfect solution is to parse the GIF frame by yourself.