我找到了一些方法,但他们实际上正在阅读框架和应用转换,这降低了动画的质量.. 有没有办法在iPHone应用程序上显示GIF,因为它是..? 在此先感谢..
答案 0 :(得分: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];
答案 1 :(得分:0)
使用网络视图。
if let path = Bundle.main.path(forResource: "animated", ofType: "gif") {
let url = URL(fileURLWithPath: path)
let request = URLRequest.init(url: url)
webview.loadRequest(request)
}
这将渲染您的图像并按预期为其设置动画。