IconDownloader, problem with lazy downloading

Posted by Junior B. on Stack Overflow See other posts from Stack Overflow or by Junior B.
Published on 2010-06-08T08:20:52Z Indexed on 2010/06/08 8:22 UTC
Read the original article Hit count: 256

My problem is simple to be described but it seems to be hard to solve. The problem is loading icons, with a custom class like IconDownloader.m provided by an official example from Apple, avoiding crashes if I release the view.

I've added the IconDownloader class to my app, but it's clear that this approach is good only if the tableview is the root. The big problem is when the view is not the root one. F.e: if I start to scroll my second view (the app now load the icons) and, without leaving it the time to finish the download, I go back to root, the app crash because the view that have to be updated with new icons doesn't exist anymore.

One possible solution could be implement an OperationQueue in the view, but with this approach I've to stop the queue when I change the view and restart it when I come back and the idea to have N queues don't make me enthusiastic.

Anyone found a good solution for this problem?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about lazy-loading