Is it possible to store an image name in an array then have a UIImage load this image through referencing the array something like this
[imageView setImage:[UIImage imageNamed:[quizArray objectAtIndex:1]]];
the image is in the resource folder
thanks Chris
ps … beginner
Absolutely possible. However, when you say
the image is in the resource folder, I’m assuming that means that you just want to get an image from your resources folder, then display it, correct?If so, there’s no need to stuff it in an array. Just access it like this:
However, in your example you used
[quizArray objectAtIndex:1]in combination withimageNamed:. Remember,imageNamed:only takes a string parameter, so passing an object to it will crash your application.I would arrange your question in a different way. Instead of using arrays, you’d be better off with using dictionaries. Like this:
Then to access it, you can just use the key names, like this: