nicklockwood/AsyncImageView — Issue #4: use ImageURL after a certain process completes
Author: bolshas
Created: 2011-11-06 19:47:42+00:00
State: open

Hi,

I followed your suggestion to usi AsyncImageView class for loading images in background thread. However I came upon another issues. In my program, before I set the imageview, I have to call my web service via AsiHTTPRequest asynchronously, which pre-renders a certain image for me (this takes about 0.25 seconds per image).

So in carousel's viewForItemAtIndex I do this:

UIImageView *imgView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"noImageCarousel.png"]] autorelease];
[[Globals sharedGlobals] generateImageForIndex:index];

The second line starts the asynchronous request, which calls my web service, and receives a reply that the image has been created and is now stored on the server.

Then in the didfinishselector of the former request I do this:

UIImageView *imgView = (UIImageView *)[galleryCarousel.carousel itemViewAtIndex:[index intValue]];
[[AsyncImageLoader sharedLoader] cancelLoadingURL:imgView.imageURL];
imgView.imageURL = [self smallImageURLAtIndex:[index intValue]];

The problem is that imageURL method is never entered into and nothing is updated. I tried putting a breakpoint in the code of the setImageURL but it is never reached.

I don't know if this is an issue or my bad coding :)