I am trying to show image in an imageView inside table cell. Name of Image I pull from web service and then put it in object s property which is NSString type.
//Get image corresponding to row index from array
Visitors *tmp = [allItems objectAtIndex:[indexPath row]];
//This works perfectly
[[cell textLabel] setText:[tmp fName]];
[[cell detailTextLabel] setText:[tmp flagName]];
NSString *pathToImage = [tmp flagName];
//This prints correct image file name, like usflag.gif
NSLog(@"%@ ",pathToImage);
//This shows images in each cell
cell.imageView.image =[UIImage imageNamed:@"usflag.gif"];
//This shows nothing
cell.imageView.image =[UIImage imageNamed:pathToImage];
请允许我解释一下,它为什么能够读到形象,什么是使它发挥作用的正确方式。
谢谢。