UIImage setting value from filename in database
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.childControlle开发者_StackOverflowr.stepImage.image = animalImage;
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.
精彩评论