IOS uses uiview to display GIF images + ImageMagick installed on Mac

Source: Internet
Author: User
Tags imagemagick
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.

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.