1

In SDWebImage it is possible to prefetch (early loading) images upfront like this:

[[SDWebImagePrefetcher sharedImagePrefetcher] prefetchURLs:<NArray with image URLs>];

Is there a way to achieve the same with Haneke, please?

It seems there is a Preload policy, but unsure how to utilise it, e.g. HNKPreloadPolicyAll

Houman
  • 64,245
  • 87
  • 278
  • 460
  • You might also check out [DFImageManager](https://github.com/kean/DFImageManager) if SDWebImage doesn't work for you. – kean Jul 20 '15 at 12:00

1 Answers1

1

I needed this functionality today, and I found that if you loop through your array of URL's and call hnk_setImageFromURL with a temporary UIImageView, the images are cached.

- (void) cacheImagesInURLs:(NSArray <NSString*>*)array;
{
    for (NSString *path in array) {
        UIImageView *tempImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, kMaxWidth, kMaxHeight)];
        tempImageView.hnk_cacheFormat = [self setImageCacheFormat];

        [tempImageView hnk_setImageFromURL:[NSURL URLWithString:path] placeholder:nil];
    }
}