如何在我的 iPhone 应用程序中使用动画 .gif? [英] How do I use an animated .gif in my iPhone application?

查看:30
本文介绍了如何在我的 iPhone 应用程序中使用动画 .gif?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个要在 iPhone 应用程序中使用的动画 gif 文件,但动画不起作用.有人知道怎么解决吗?

I have an animated gif file that I want to use in my iPhone application, but the animation doesn't work. Does anybody know how to fix it?

推荐答案

如果您有一系列想要动画的图像,您可以使用 UIImageView 轻松实现:

If you have a serie of images you want to animate you can easily do it with UIImageView:

UIImage *blur5 = [UIImage imageNamed:@"blur5.png"];
UIImage *blur6 = [UIImage imageNamed:@"blur6.png"];

self.imageView.animationImages = [[NSArray alloc] initWithObjects:blur5, blur6, nil];
self.imageView.animationRepeatCount = 5;
[self.imageView startAnimating];

我发现这比尝试使用 UIWebView 更容易.

I found this easier than trying to use UIWebView.

这篇关于如何在我的 iPhone 应用程序中使用动画 .gif?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆