title: Loading an image into UIImage asynchronously
body: <p>I'm developing an iOS 4 application with iOS 5.0 SDK and XCode 4.2.</p>
  
  <p>I have to show some post blogs into a UITableView. When I have retreived all web service data, I use this method to create an UITableViewCell:</p>
  
  <pre><code>- (BlogTableViewCell *)tableView:(UITableView *)tableView
           cellForRowAtIndexPath:(NSIndexPath *)indexPath
  {
      static NSString* cellIdentifier = @"BlogCell";
  
      BlogTableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
  
      if (cell == nil)
      {
          NSArray* topLevelObjects =  [[NSBundle mainBundle] loadNibNamed:@"BlogTableViewCell" owner:nil options:nil];
  
          for(id currentObject in topLevelObjects)
          {
              if ([currentObject isKindOfClass:[BlogTableViewCell class]])
              {
                  cell = (BlogTableViewCell *)currentObject;
                  break;
              }
          }
      }
  
      BlogEntry* entry = [blogEntries objectAtIndex:indexPath.row];
  
      cell.title.text = entry.title;
      cell.text.text = entry.text;
      cell.photo.image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:entry.photo]]];
  
      return cell;
  }
  </code></pre>
  
  <p>But this line:</p>
  
  <pre><code>cell.photo.image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:entry.photo]]];
  </code></pre>
  
  <p>it is so slow (entry.photo has a http url).</p>
  
  <p>Is there any way to load that image asynchronously? I think it is difficult because tableView:cellForRowAtIndexPath is called very often.</p>