我如何实现setBackgroundImage来短暂更改特定按钮的背景,然后将其恢复为正常状态?
这是我的代码:
@IBAction func answerPressed(_发送者:UIButton){
if sender.tag == selectedAnswer{
//Answer is correct so I'd like the button background to briefly turn green
score += 1
}
else {
//Answer is not correct so the background should turn red
attempts -= 1
}
wordNumber += 1
updateWord()
}