I’ve created some code to display a image in a imageview when the current image is equal to a certain imageview. It works correctly but If I decide to go out of the app and then back in it somehow doesn’t see the current image and the comparison doesn’t work anymore.
if (imageview25.image == [UIImage imageNamed:@"BLUEBOXPUNT.png"]){
key25.hidden = NO;
}
So this works but when I leave app and come back in it doesn’t see that the image is equal to BLUEBOXPUNT.png
Is there a other way to do this or to do something like in Java I would do imageview25.getImage. I think that would work.
Your comparison logic is checking whether two image objects have the same address. This will only work while the image remains in cache. It’s likely that a memory warning will cause the same problem you see when switching apps.
If you want to associate images and their file names, I think you’ll need to do it yourself, possibly with a dictionary that is keyed to the names.