Your arrayOfImages
is an array of image names (strings), so setImage
won't work with that. Instead of:
[[cell myImage]setImage:[arrayOfImages objectAtIndex:indexPath.item]];
you probably intended:
[[cell myImage]setImage:[UIImage imageNamed:[arrayOfImages objectAtIndex:indexPath.item]]];
or, equivalently:
cell.myImage.image = [UIImage imageNamed:arrayOfImages[indexPath.item]];
You might even want to rename arrayOfImages
to be arrayOfImageNames
(or just imageNames
or whatever) to eliminate this possible source of confusion.
(BTW, it was a good call not to put the actual images in the array. We should always create the image objects in cellForItemAtIndexPath
on the basis of the image names in the array.)