When your buttons are tapped, they will execute their action selector. The sender
parameter passed to the action selector is in fact the button that was tapped and you can utilise this to change its properties. To reverse the change, you can use dispatch_after
to delay the secondary change.
- (void)buttonWasTapped:(id)sender
{
__block UIButton *button = (UIButton *)sender; // This is the button that was tapped
[button setImage:[UIImage imageNamed:@"blah"] forState:UIControlStateNormal];
double delayInSeconds = 5.0;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
[button setImage:[UIImage imageNamed:@"original_image"] forState:UIControlStateNormal];
});
}