2

Using SDWebImage 3 in an iOS 5.1 project (iPad).

We show fairly large images( 700x500), and we have lots of them (+1000). We are prefetching the images and caching to disk and then allows the user browse through them.

It works fine. Except that while you browse through the images you always see for an slight moment that the placeholder is displayed, creating a very annoying effect.

In my use case it would be much more preferable to wait the small time to check the disk cache and process than displaying a placeholder for less than half a second (it basically just blinks).

My issue is similar to this one: How to get filesystem path to image cached with SDWebImage (iOS). Note: the approach of trying to fine out the filesystem path of the cache is wrong in my opinion. I am just referencing it because it also explains my use-case.

What I would wish to have is a way to tell SDWebImage to not use the placeholder if the image is in local storage. If I can't do that I might need to look for other libraries (I welcome advise).

Note: we are also using RestKit (0.20) + AFNetworking.

Community
  • 1
  • 1
rufo
  • 5,158
  • 2
  • 36
  • 47

1 Answers1

3

Following @sergio's advise I modified SDWebImage. For anybody interested there is a forked version of the project: https://github.com/josea/SDWebImage

The usage is: [imageView setImageWithURL:url placeholderImage:[UIImage imageNamed:@"placeholder.png"] syncDiskLoad:YES];

I will put a pull request to the owner to see if my changes are incorporated to the master branch.

Update:

You can just do this to avoid the flickering (this works with the master branch of the project):

[imageView setImageWithURL:url placeholderImage:imageView.image options:0 
 progress:^(NSUInteger receivedSize, long long expectedSize) {
        imageView.image = [UIImage imageNamed:@"QuestionMarkFace.png"];
 } completed:nil];
rufo
  • 5,158
  • 2
  • 36
  • 47