esh
esh

Reputation: 2872

AFNetworking prefetch other images

I am using the UIImageView + AFNetworking category to download and display images from an array of URLs and populate a table view.

Now I find that the other images are delayed because only the current cell's image will be loaded. I need to keep busy by fetching other images as well.

My idea would be to write a for loop and start downloading and caching with AFNetworking, say, 10 other requests starting from current indexPath.

Or should I just do the usual dispatch_async in the completion block and start fetching the mentioned 20 other images?

Any better ideas?

Upvotes: 0

Views: 1003

Answers (1)

mattt
mattt

Reputation: 19544

In most cases, pre-fetching won't be nearly as beneficial as you might expect. On a mobile device, power and bandwidth are limited resources, which calls into question the value of loading things that a user may not actually ever see. You're most likely doing a disservice by trying to be clever about this.

Upvotes: 1

Related Questions