根据此处找到的答案Fading out an UIButton when touches我修改了代码,如下所示,其中 overlayButton 是位于按钮上方的隐藏 UIImage
- (IBAction)buttonAction:(UIButton*)sender {
overlayButton.alpha = 1;
[overlayButton setHidden:FALSE];
[[UIApplication sharedApplication] beginIgnoringInteractionEvents];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.3];
[UIView setAnimationDelegate:[UIApplication sharedApplication]];
[UIView setAnimationDidStopSelector:@selector(endIgnoringInteractionEvents)];
overlayButton.alpha = 0;
[UIView commitAnimations];
}