我的应用程序由几个按钮组成,当用户触摸其中一个按钮时,它们下方会出现一个阴影,其余按钮不应有任何背景图像,我需要类似 Instagram 应用程序效果的东西,这是我的代码,但我的问题是当我触摸时其他按钮没有出现阴影。
#define BGB [btn setBackgroundImage:[UIImage imageNamed:@"shadow.png"] forState:UIControlStateNormal]
#define _BGB [btn setBackgroundImage:nil forState:UIControlStateNormal]
- (IBAction)effectsPerform:(id)sender {
UIButton *btn = (UIButton *)sender;
if (btn == EB0) { BGB; } else { _BGB; }
if (btn == EB1) { BGB; } else { _BGB; }
if (btn == EB2) { BGB; } else { _BGB; }
//and other buttons ...
}