title: UITableView On Screen Image Download Lazy Loading
body: <p>First of all this is not a duplicate. I have seen some identical questions but they didn't help me as my problem varies a little bit.</p>
  
  <p>Using the following code i am download the images asynchronously in my project.</p>
  
  <pre><code>{
      NSURL *imageURL = [NSURL URLWithString:imageURLString];
      [self downloadThumbnails:imageURL];
  }
  
  - (void) downloadThumbnails:(NSURL *)finalUrl
  {
      dispatch_group_async(((RSSChannel *)self.parentParserDelegate).imageDownloadGroup, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
  
          NSData *tempData = [NSData dataWithContentsOfURL:finalUrl];
  
          dispatch_async(dispatch_get_main_queue(), ^{
  
              thumbnail = [UIImage imageWithData:tempData];
          });
      });
  }
  </code></pre>
  
  <p>Due to the logic of the program, i have used the above code in files other than the tableview controller which is showing all the data after getting it from the web service.</p>
  
  <p><strong>PROBLEM:</strong> On screen images does not show up until i scroll. The off screen images are refreshed first. What can i do to solve my problem.</p>
  
  <p>Apple's lazy loading project is using scrollViewDidEndDragging and scrollViewDidEndDecelerating to load the images but the project is way too big to understand plus my code is in files other than the tableview controller. </p>
  
  <p><strong>NOTE:</strong> Kindly do not recommend third party libraries like SDWebImage etc. </p>
  
  <p><strong>UPDATE:</strong> As most of people are unable to get the problem, i must clarify that this problem is not associated with downloading, caching and re-loading the images in tableview. So kindly do not recommend third party libraries. The problem is that images are only showing when the user scrolls the tableview instead of loading the on screen ones. </p>
  
  <p>Thanks in advance</p>