I have several UIView extensions that I call from a tap gesture recognizer. Why does the background color extension have to finish animating before additional taps can be recognized? The alpha extension plus another one I use to animate the position of a view work just fine - meaning I can tap as quickly as I want and they respond immediately.
@IBAction func taps(sender: UITapGestureRecognizer) {
if !isAnimating {
currentLabel.fadeOut()
backgroundColor.fadeBackgroundOut()
isAnimating = true
} else {
currentLabel.fadeIn()
backgroundColor.fadeBackgroundIn(curBackground)
isAnimating = false
}
}
func fadeOut() {
UIView.animateWithDuration(0.5,
delay: 0.0,
options: UIViewAnimationOptions.CurveEaseOut,
animations: { self.alpha = 0.0 },
completion: nil)
}
func fadeBackgroundIn(aColor: UIColor) {
UIView.animateWithDuration(1.0,
delay: 0,
options: UIViewAnimationOptions.CurveEaseIn,
animations: { self.backgroundColor = aColor },
completion: nil)
}