我有一個UIImageView與點擊手勢識別器。點擊時,我想讓UIImageView在2張圖片之間切換。我已經實現了這個代碼,但是當UIImageView被反覆快速切換時,UIImageView似乎滯後了。UIImageView圖像更改延遲時點擊
我的代碼:
@IBOutlet weak var moneyButton: UIImageView!
let benchUpImage = UIImage(named: "benchUp")
let benchDownImage = UIImage(named: "benchDown")
var benchIsDown = false
func moneyButtonPressed(sender: UITapGestureRecognizer){
if benchIsDown == false{
moneyButton.image = benchDownImage
benchIsDown = true
}else{
moneyButton.image = benchUpImage
benchIsDown = false
}
}
你是什麼意思「落後?」 - 什麼是快速點擊? – Appygix
也許圖像太大? – GeneCode
非常快速地重複點擊圖像視圖 –