Git Product home page Git Product logo

Comments (2)

nicklockwood avatar nicklockwood commented on July 20, 2024

If you are already downloading your images asynchronously using ASI, you may not get any benefit from AsyncImageView, as doing that loading is it's main purpose.

Trying to get the item view from the carousel probably won't work because that will return nil if the item is offscreen as item views are only loaded when needed. That's probably why your imageURL method isn't being called - imgView is nil.

What you should do instead is call [carousel reloadItemAtIndex:animated] when your AsiHTTPRequest finishes downloading and processing your image. That will re-request the itemView from the datasource, and at that point you will have the image available, so you can set it directly on the view before returning it.

You will need to keep a cache of your downloaded images if you aren't already so that once they've been downloaded they are available to be requested by the carousel whenever it needs to display them.

Nick

On 6 Nov 2011, at 19:47, Andrius Bolsaitis wrote:

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 :)


Reply to this email directly or view it on GitHub:
#4

from asyncimageview.

bolshas avatar bolshas commented on July 20, 2024

Hi,

Thanks for your help. I fixed the code by modifying me web service.

Kind regards

Andrius

from asyncimageview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.