I am using animations to transform a button when it is clicked, I was able to make the button bigger. However, I thought that by using .Repeat and .Autoreverse, the button would go back to its normal state. (scale 1.0) but that is not the case! Maybe I misunderstood the tutorials and questions that I read regarding .AnimateWithDuration
??
This is the code that I am using:
let button = sender as! UIButton
UIView.animateWithDuration(1.0, delay: 0.6,
options: [.Repeat, .Autoreverse, .AllowUserInteraction],
animations:{
button.transform = CGAffineTransformMakeScale(1.2, 1.2)
}, completion: nil)
In another question I saw that the problem may be resolved by adding .AllowUserInteraction but that is not the case.
I don't know if it even matters but this code is enclosed within a touch event.
@IBAction func addButtonClicked(sender: AnyObject) {}
What could be going on here? isn't this how you are supposed to reverse the animation?