我找到了一些方法,但它们实际上是在读取帧并应用过渡,这会降低动画的质量。 有什么办法可以在 iPhone 应用程序上显示 GIF 吗? 提前致谢..
最佳答案
动画 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];
关于iphone - 如何在 iPhone UIIMageView 上显示 GIF 图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2578624/