I have two buttons to move views. When I press the first button it will move a view and the other will move it back.
The first animation has a completion block, but I want to prevent this block from executing when the user moves the view back before the completion is done.
I have tried using solutions given to other questions similar to this but it doesn't seem to stop the execution of the first completion block.
@IBOutlet func moveView(sender: AnyObject) {
UIView.animateWithDuration(0.5, delay: 0, usingSpringWithDamping: 1, initialSpringVelocity: 0, options: .AllowUserInteraction, animations: { /* animation */ }) { _ in /* completion */ }
}
@IBOutlet func moveBack(sender: AnyObject) {
UIView.animateWithDuration(0.0, delay: 0, usingSpringWithDamping: 1, initialSpringVelocity: 0, options: .BeginFromCurrentState, animations: { /* animation */ }) { _ in /* completion */ }
}
I also tried removing all the animations and the completion parameter will be false but the animation will just jump to the end and animate from there.
Any ideas is very much appreciated.