title: iOS lazy-loading of table images
body: <p>I have successfully implemented lazy-loading of images in my app using the example provided by apple <a href="http://developer.apple.com/library/ios/#samplecode/LazyTableImages/Introduction/Intro.html#//apple_ref/doc/uid/DTS40009394-Intro-DontLinkElementID_2" rel="noreferrer">here</a>. The thing is that, I want the image to load as I am scrolling, but the image loads into the cell only when I finish dragging (Release my finger from the screen. Until then the cell remains empty). I have modified the code as follows:</p>
  
  <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  {
  
      //NSLog(@"cell for row at indexpath, size - %f, current - %d", flowTable.contentSize.height, self.current);
  
      NSString *CellIdentifier = @"FlowCell";
  
      MyFlowCell *cell = (MyFlowCell *)[self.flowTable dequeueReusableCellWithIdentifier:CellIdentifier];
  
      if (cell == nil) {
  
          NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"FlowCell" owner:nil options:nil];
         // cell = [nib objectAtIndex:0];
  
          for(id currentObject in nib)
  
          {
  
          if([currentObject isKindOfClass:[MyFlowCell class]])
  
          {
              cell = (MyFlowCell *)currentObject;
  
              break;
          }
          }
      }
  
      ImageDetails *rowItem = [self.imageData objectAtIndex:indexPath.row];
  
      if (!rowItem.mainImage)
      {  
         // if (self.flowTable.dragging == NO &amp;&amp; self.flowTable.decelerating == NO)
         // {
  
              [self startIconDownload:rowItem forIndexPath:indexPath];
  
          //}
  
          cell.mainImage.backgroundColor = [UIColor grayColor];
  
      }
      else
      {
  
              cell.mainImage.image = rowItem.mainImage;
  
      }
      }
  
  
      return cell;
  }
  
  
  - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
  {
      if (!decelerate)
      {
        //  [self loadImagesForOnscreenRows];
      }
  }
  
  - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
  {
      //[self loadImagesForOnscreenRows];
  }
  </code></pre>
  
  <p>Moreover, I found out that in my ImageDownloader class, the NSURLConnection doesn't even receive the response until I release my finger from the screen. I have been trying to find out why this is happening, but I haven't been successful so far. Please tell me if I've been missing something.</p>