How do I put a downloaded image into a cell?
I don’t know how to put response data out when it loaded into cell.imageView.image.
Here is the code:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
....
....
NSURL *photoURL = [NSURL URLWithString:user.photo];
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:photoURL];
[request setDownloadCache:[ASIDownloadCache sharedCache]];
[request setDelegate:self];
[request startAsynchronous];
cell.textLabel.text = [NSString stringWithFormat:@"%@ %@",user.first_name,user.last_name];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
//image loaded
- (void)requestFinished:(ASIHTTPRequest *)request
{
NSData *responseData = [request responseData];
}
Here is a sample code to have a guide line and a brief description.