views:

299

answers:

1

Essentially, I'm working on asynchronously downloading images and adding them to specific UITableView cells (twitter profile images using MGTwitterEngine from Matt Gemmell).

I've looked at general asynchronous download code and must admit, I'm still too much of a noob to understand it well enough to adapt it to my purposes. Instead, I'm attempting to use Gemmell's included getImageAtUrl method to add the images.

I have it working to the point that -imageReceived: receives the images for visible cells, however, I'm stuck as to how to include them into the appropriate cells at that point.

    - (void)imageReceived:(UIImage *)image forRequest:(NSString *)identifier
{
    NSLog(@"Got an image:%@",image);
    // What goes here? Or elsewhere?
}

This method is within my main view controller, I also have a custom cell controller where I'm drawing the cell content using Loren Brichter's fast scrolling code.

Any help with this MGTwitterEngine method in particular, or with dynamically adding these images to my table cells would be greatly appreciated.

A: 

I've never used MGTwitterEngine, but in general I'd assume you need to:

  1. Figure out which model object the image belongs to. I assume the identifier string will help you there.

  2. Figure out the index path of the corresponding cell.

  3. Call [tableView cellForRowAtIndexPath:indexPath] to get the table cell.

  4. Put the image into the cell.

Brent Royal-Gordon