I would assign the image as a variable, then you can check if the image exists:
UIImage * flowerImage = [UIImage imageNamed:@"Flower.png"];
if (flowerImage) {
// Do something
}
else {
// Do something else
}
In the accepted answer we are checking to see if the picture equals an image with a specific name. This could go wrong as we will return no if
- The image Flower.png doesn't exist
AND
- The image Flower.png does exist but flowerImage is set to a different image meaning they are not equal
Assigning a variable to the image and then checking if the variable is assigned or not will return us a definite yes or no depending on whether Flower.png exists