在Iphone UIImageView中添加动画Gif图像 [英] Add animated Gif image in Iphone UIImageView
本文介绍了在Iphone UIImageView中添加动画Gif图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要从UIImageview中的URL加载动画Gif图像。
I need to load an animated Gif image from a URL in UIImageview.
当我使用普通代码时,图像没有加载。
When I used the normal code, the image didn't load.
有没有其他方法可以加载动画Gif图像?
Is there any other way to load animated Gif images?
推荐答案
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];
您可以加载多个gif图像。
You can load more than one gif images.
您可以使用以下 ImageMagick 命令拆分您的GIF:
You can split your gif using the following ImageMagick command:
convert +adjoin loading.gif out%d.gif
这篇关于在Iphone UIImageView中添加动画Gif图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文