SDWebImage Download image and store to cache for key

后端 未结 11 1517
失恋的感觉
失恋的感觉 2020-12-24 03:30

Hello I am using the SDWebImage framework in a project and I want to download and cache images, but I think my code is storing an image in the cache twice? Is there any way

11条回答
  •  感情败类
    2020-12-24 03:48

    //CREATE A CUSTOME IMAGEVIEW AND PASS THE IMAGE URL BY ARRAY(INDEXPATH.ROW)

    (void) loadImage:(NSString *)imageLink{
    
        imageLink = [imageLink stringByReplacingOccurrencesOfString:@" " withString:@"%20"];
    
        SDWebImageManager *manager = [SDWebImageManager sharedManager];
    
        [manager loadImageWithURL:[NSURL URLWithString:imageLink] options:SDWebImageDelayPlaceholder progress:^(NSInteger receivedSize, NSInteger expectedSize, NSURL * _Nullable targetURL) {
    
        } completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) {
    
            imageFrame.image = image;
    
        }];
    }
    

提交回复
热议问题