title: load images using SDWebImage in order
body: <p>After a lot of reading and recommendations, I am trying to implement SDWebImage framework in my app. I am able to download images from the server but the issue is that as the images are different sizes, they are not downloaded in the order that I call them (and would like them to be). </p>
  
  <p>Here is the framework for reference: <a href="https://github.com/rs/SDWebImage" rel="nofollow">https://github.com/rs/SDWebImage</a></p>
  
  <p>As you can see evidence of this from the print-line:</p>
  
  <pre><code>2013-08-20 11:11:01.785 Project[10785:c07] SD LOAD 1 array count = 1
  2013-08-20 11:11:02.668 Project[10785:c07] SD LOAD 0 array count = 2
  2013-08-20 11:11:02.946 Project[10785:c07] SD LOAD 3 array count = 3
  2013-08-20 11:11:03.306 Project[10785:c07] SD LOAD 2 array count = 4
  2013-08-20 11:11:03.862 Project[10785:c07] SD LOAD 4 array count = 5
  2013-08-20 11:11:04.094 Project[10785:c07] SD LOAD 5 array count = 6
  2013-08-20 11:11:04.793 Project[10785:c07] SD LOAD 6 array count = 7
  2013-08-20 11:11:04.837 Project[10785:c07] SD LOAD 7 array count = 8
  2013-08-20 11:11:05.046 Project[10785:c07] SD LOAD 8 array count = 9
  2013-08-20 11:11:05.428 Project[10785:c07] SD LOAD 9 array count = 10
  </code></pre>
  
  <p>Below is my method:</p>
  
  <pre><code>-(void)sdWebLoadImages:(NSMutableArray*)imagesURLS{
  
      [_loadedImages removeAllObjects];
      NSMutableArray *tempArray = [[NSMutableArray alloc]init];
      _loadedImages = tempArray;
      for (int i=0;i&lt;imagesURLS.count;i++){
  
      [_manager downloadWithURL:[imagesURLS objectAtIndex:i]
                       options:0
                      progress:^(NSUInteger receivedSize, long long expectedSize)
       {
           // progression tracking code
       }
                     completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType,BOOL finished)
       {
           if (image &amp;&amp; finished)
           {
  
               [_loadedImages addObject:image];
              NSLog(@"SD LOAD %i array count = %i",i,_loadedImages.count);
           }
       }];
      }
  }
  </code></pre>
  
  <p>How can I fix this (is it something in my for loop logic?). Also, I am trying to cancel all the downloads when a button is clicked, and am using [_manager cancelAll] but doesn't seem to work - any idea why?</p>
  
  <p>Thanks fam!</p>
  
  <p><strong>ADDED:</strong></p>
  
  <p>The issue now is that the manager inserts all the cached images into the array first, causing the order to be disrupted, even after I set the setMaxConcurrentOperationCount to 1. Not sure how to keep the downloading in order even with cached images.</p>