sd 加载本地 webp


 NSString *imageName = [NSString stringWithFormat:@"friends_time_line_sleep%d",(arc4random() % 20)+1];
        
        UIImage *image = [SharedData WebpCacheImageWithName:imageName];
        if (image) {
            _ivBackground.image = image;
        }else{
            NSString *imagePath = [[NSBundle mainBundle]pathForResource:imageName ofType:@"webp"];
            NSData *data= [[NSData alloc] initWithContentsOfFile:imagePath];
            UIImage *imgData = [UIImage sd_imageWithWebPData:data];
            _ivBackground.image = imgData;
            [SharedData setWebpCacheImage:imgData WithName:imageName];
            
        }
        

你可能感兴趣的:(sd 加载本地 webp)