title: Images from URLs (RSS Reader) displaying in table view - problem
body: <p>I'm having a problem with a table view and some custom cells.  Here is my code:</p>
  
  <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  NSLog(@"cellForRowAtIndexPath");
  static NSString *MyIdentifier = @"customCell";
  
  EventTableCell *cell = (EventTableCell *)[tableView dequeueReusableCellWithIdentifier:MyIdentifier];
  
  if (cell == nil) {
      //cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:MyIdentifier] autorelease];
      [[NSBundle mainBundle] loadNibNamed:@"EventTableCell" owner:self options:nil];
      cell = self.eventCell;
  }
  
  //Set up the cell
  int storyIndex = [indexPath indexAtPosition: [indexPath length] - 1];
  [[cell eventNameLabel] setText:[[stories objectAtIndex: storyIndex] objectForKey: @"title"]];
  [[cell eventDateLabel] setText:[[stories objectAtIndex: storyIndex] objectForKey: @"date"]];
  
  NSString * storyLink = [[stories objectAtIndex: storyIndex] objectForKey: @"link"];
  
  // clean up the link - get rid of spaces, returns, and tabs...
  storyLink = [storyLink stringByReplacingOccurrencesOfString:@" " withString:@""];
  storyLink = [storyLink stringByReplacingOccurrencesOfString:@"\n" withString:@""];
  storyLink = [storyLink stringByReplacingOccurrencesOfString:@"  " withString:@""];
  
  //NSString *string = [[NSString alloc] stringWithString:[[stories objectAtIndex: storyIndex] objectForKey: @"link"]];
  NSURL *url = [NSURL URLWithString:storyLink];
  NSData *data = [[NSData alloc] initWithContentsOfURL: url];
  UIImage *image = [UIImage imageWithData: data];
  [[cell eventImage] setImage:image];
  
  return cell;
  }
  </code></pre>
  
  <p>My table has a lot of these custom cells in it, more than the view can show at once.  So therefore I need to scroll up/down to see all the cells.  My problem is this, when I scroll it lags a lot and in the debugger console it calls cellForRowAtIndexPath as each new cell comes into the view.  Each cell holds an image which is downloaded from a URL and hence has to be converted to a UIImage.  I believe this is whats causing the lag.  </p>
  
  <p>Can anyone direct me as to what I need to do in order to download the images and have them display in the cells without causing major lag in the app?</p>
  
  <p>IE: Where would I put the download/conversion code so that the image is already stored as an image before the cell needs to be dispayed?</p>
  
  <p>Thanks,</p>
  
  <p>Jack</p>