views:

94

answers:

2

Hi All
I have a SQLite database containing several items of data and in there i have included a column with the file names of the images i want to use in my app.
I know how to pull this data out but i dont know the correct syntax to use to set that filename to the uiimage.
Here is an example of what i thought it would look like.

UIImage *animalImage = [[UIImage imageNamed:[database imagefilename];  
self.childController.stepImage.image = animalImage;
+1  A: 

Assuming '[database imagefilename]' returns an NSString with the filename of the image then this looks good. You're missing a ']' at the end of the first line (but I assume thats a copy paste error :-) )

Again assuming that 'self.childController.stepImage' is a UIImageView then the most likely error is that the name returned by '[database imagefilename]' does not match an image file in the application bundle.

RichB
Seconded. Also, the debugger is your friend. Break on that second line, and see whether animalImage has a value, and what -imagefilename returns.
Sixten Otto
A: 

Thanks,

yes that was a typo..

And this answered my question.. I had the syntax right as above but i wasn't pulling it out the database as an NSString.

Cheers

SteveU