【问题标题】:GIF image not showing up on iphonesGIF 图像不显示在 iPhone 上
【发布时间】:2020-05-29 11:05:41
【问题描述】:

我有一个以 .gif 结尾的 gif 图像,它可以在 android 手机和 chrome 上正确显示。 Iphone 无法显示 gif。下面是它应该是什么样子的图像,以及它在 Iphone 上显示的图像。

iphone im 测试用的是 Iphone 6 ios 11.4

iphone 上的 gif 图像,因为它没有显示出来。

闪烁的 gif 显示在其他浏览器和手机上。

【问题讨论】:

    标签: ios iphone gif


    【解决方案1】:

    如果您在项目中使用 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];
            });
        };
    

    【讨论】:

    • 我会看看这个。知道为什么会发生这种情况吗?
    猜你喜欢
    • 2012-08-28
    • 1970-01-01
    • 1970-01-01
    • 2017-02-13
    • 1970-01-01
    • 1970-01-01
    • 2012-12-13
    • 2022-01-18
    • 2012-06-14
    相关资源
    最近更新 更多