From Apple's Documentation...
– dequeueReusableCellWithReuseIdentifier:forIndexPath:
Call this method from your data source object when asked to provide a new cell for the collection view. This method dequeues an existing cell if one is available or creates a new one based on the class or nib file you previously registered.
Important: You must register a class or nib file using the registerClass:forCellWithReuseIdentifier: or registerNib:forCellWithReuseIdentifier: method before calling this method.
EDIT: I assume you're loading the images asynchronously if not then use the following code.
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0ul);
dispatch_async(queue, ^{
UIImage *image = [UIImage imageWithData:[NSData dataWithContentsOfURL:
[NSURL URLWithString:@"ur image url"]]]];
dispatch_sync(dispatch_get_main_queue(), ^{
[[cell imageView] setImage:image];
[cell setNeedsLayout];
});
});
EDIT 2: atomk's suggestion(below comment) makes sense,so i won't be posting the code here.In replacement you can use the library called SDWebImage.You can load as many images you want and the same URL won't be downloaded several times as per the author of the code.