I'm animating constraints the usual way:
centerXsettingsBtnConstraint.constant = aValue;
[UIView animateWithDuration:.5
animations:^{
[self.view layoutIfNeeded];
} completion:^(BOOL finished) {
isAnimating = NO;}];
When I'm rotating the device I want to cancel this animation and update constraint with new values.
I tried to call
[self.view.layer removeAllAnimations];
but the animation still goes on till the rotation of the device is over. Only then I can update with new constraints, but during the rotation it's all a mess on the screen.
Is there a way to cancel constraints animation?
You must call the remove.. method on each subview:
I'll use Swift: