Cocoa Touch was developed around the Model-View-Controller pattern, so you can try using this pattern. Instead of trying to get status information - the selected penguin - from the view - button - will save it in an instance variable in your controller class.
Your image installation code might look like this:
self.currentImage = @"Penguin.png"; [m1 setImage:[UIImage imageNamed: currentImage] forState:UIControlStateNormal];
Then when you need to check the value:
if ([@"Penguin.png" isEqual:self.currentImage]) { do something; }
source share