GIF图像未显示在iPhone上

问题描述 投票:-3回答:1

我有一个以.gif结尾的gif图像,它在Android手机和Chrome上正确显示。 iPhone无法显示gif。下面是它的外观以及在Iphone上显示的图像。

正在测试的iPhone是Iphone 6 ios 11.4

iphone上的gif图片,因为它没有显示。

enter image description here

在其他浏览器和电话上显示gif闪烁。

**enter image description here**

ios iphone gif
1个回答
0
投票

如果在项目中使用SDWebImage库进行图像加载和缓存,则会找到一个名为FLAnimatedImage的类。使用此功能,您可以轻松集成GIF。

FLAnimatedImage *image = [[FLAnimatedImage alloc] initWithAnimatedGIFData:[NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"<your_file_name>" ofType:@"gif"]]];

    [yourImageView setAnimatedImage:image];
    __weak typeof(self) weakself = self;
    yourImageView.loopCompletionBlock = ^(NSUInteger loopCountRemaining) {
        dispatch_async(dispatch_get_main_queue(), ^{
            [weakself.yourImageView startAnimating];
        });
    };
© www.soinside.com 2019 - 2024. All rights reserved.