动画 GIF 在 iPhone 上不起作用 [英] Animated GIF does not work on iPhone

查看:37
本文介绍了动画 GIF 在 iPhone 上不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 cell.image = 一个动画 gif 文件(单元格是 UITableViewCell).但是,它没有动画.有什么办法可以解决吗?

I am using cell.image = an animated gif file (cell is UITableViewCell). However, it does not animate. Is there any way I can fix it?

推荐答案

UIImageView 提供必要的 API 来制作您自己的动画,如下所示:

UIImageView provides the necessary APIs to produce your own animations like this:

UIImage *frame1 = [UIImage imageNamed:@"frame1.png"];
UIImage *frame2 = [UIImage imageNamed:@"frame2.png"];
UIImage *frame3 = [UIImage imageNamed:@"frame3.png"];
UIImage *frame4 = [UIImage imageNamed:@"frame4.png"];


UIImageView.animationImages = [[NSArray alloc] initWithObjects:frame1, frame2, frame3, frame4, nil];
UIImageView.animationDuration = 1.0 //defaults is number of animation images * 1/30th of a second
UIImageView.animationRepeatCount = 5; //default is 0, which repeats indefinitely
[UIImageView startAnimating];

//[uiImageView stopAnimating];

这篇关于动画 GIF 在 iPhone 上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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