如何在iPhone UIIMageView上显示GIF图像

Jig*_*shi 2 iphone uiimageview

我找到了一些方法,但他们实际上是阅读框架和应用转换,这降低了动画的质量..有没有办法在iPHone应用程序上显示GIF,因为它是..?提前致谢..

run*_*mad 12

动画GIF不会设置动画,但如果您有GIF,请将每个动画保存为单独的GIF,然后使用您刚刚保存的所有GIF设置animationImages数组:

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