iphone - 如何在 iPhone UIIMageView 上显示 GIF 图像

标签 iphone uiimageview

我找到了一些方法,但它们实际上是在读取帧并应用过渡,这会降低动画的质量。 有什么办法可以在 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/

相关文章:

iphone - iPad 上的 UIView 与 GroupTableViewBackgroundColor

iphone - 如何将后置摄像头实时视频显示到 UIImageView?

ios - 如何在uitableviewcell中设置来自服务器的图像路径

iphone - 图像裁剪给出了错误的图像部分

ios - 如何获取围绕某个点的 UIImageView 的一部分

objective-c - 如何检测 UITableViewCellStyleSubtitle 样式中 UITableViewCell 对象的 UIImageView 上的触摸

.net - iPhone/Windows Mobile开发平台的长期潜力

iPhone:绘制一条曲线直到它变成一个圆形动画

iPhone App 在 iOS 4.0 或更高版本上随机崩溃。

swift - 更改导航栏按钮的颜色