Might not be the most effective but its what worked for me
@IBOutlet weak var logoIndicator: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
}
@IBAction func logoEraseAll(sender: AnyObject) {
onTapped()
}
func onTapped(){
let afterTapped = UIImage(named: "grey.png") as UIImage!
self.logoIndicator.setImage(afterTapped, forState: .Normal)
logoIndicator.enabled = false
delay(2) {
self.transitionBack()
}
}
func delay(delay:Double, closure:()->()) {
dispatch_after(
dispatch_time( DISPATCH_TIME_NOW, Int64(delay * Double(NSEC_PER_SEC))), dispatch_get_main_queue(), closure)
}
func transitionBack(){
UIView.transitionWithView(logoIndicator, duration: 2, options: .TransitionCrossDissolve, animations: {
self.logoIndicator.setImage(UIImage(named: "color.png"), forState: .Normal)
}, completion: nil)
logoIndicator.enabled = true
}
}