# Problème dans l'affichage d'une image dns un Cell depuis un



## cybergod (2 Décembre 2010)

I have an iPhone application that reads an XML file from a server this file contains titles of articles, a description for every article and an image. I do parse a XML very well and all the fields are reachable (title, description...) even the image field. When I put the URL of the image from my XML in a label in order to verify if the URL is parsed I get the URL without a problem. The problem is that when the imageView takes the URL as a source of the image I dont get the image but when I write the same URL as a string I do have image in my View.

Here is my Code that Im using.


//  FirstViewController.m


// Returns cell to render for each row
- (UITableViewCell *)tableViewUITableView *)tableView cellForRowAtIndexPathNSIndexPath *)indexPath { 
 static NSString *MyIdentifier = @"MyIdentifier";
 MyIdentifier = @"tblCellView"; 
 TableCellView *cell = (TableCellView *)[tableView dequeueReusableCellWithIdentifier:MyIdentifier];
 if(cell == nil) {
  [[NSBundle mainBundle] loadNibNamed"TableCellView" owner:self options:nil];
  cell = tblCell;
 }

//Here the XMLparser
 item *aBook = [appDelegate.books objectAtIndex:indexPath.row];  
//Creation of the image that will take the URL (aBook.image) as a source
UIImage *image = [[UIImage alloc] initWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:aBook.image]]];
[cell setDescpText2:aBook.title];
 [cell setLabelText:aBook.date];
 [cell setDescpText:aBook.description];
 [cell setProductImage:image]; 
//All the fields do appear in my application properly only the image doesnt. When I write the content of the aBook.image in a Label I do see the URL of my image.
 return cell;
}
//Even when I show the aBook.image in the NsLog the URL is the right one but only when I call it into the image that I dont get anything

Thank you for any help that could solve this problem.


----------

