动画GIF无法在iPhone上运行

eba*_*unt 7 iphone gif animated-gif uiimageview ios

我正在使用cell.image = an animated gif file(细胞是UITableViewCell).但是,它没有动画.有什么办法可以解决吗?

Nat*_*ies 16

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

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];
Run Code Online (Sandbox Code Playgroud)


Gam*_*eak -2

您唯一的选择是编写自己的在视图中渲染 gif 的机制,或者等待苹果修复它。