Search code examples
iosswift2uiviewanimationuianimation

Swift UIViewAnimation with spring moves to wrong place then jumps


I'm trying to animate a label moving to another place with a spring effect.

UIView.animateWithDuration(1, delay: 1, usingSpringWithDamping: 0.9, initialSpringVelocity: 0, options: [], animations: { () -> Void in
    self.textLabel.center = CGPointMake(self.view.center.x, self.view.center.y-220)
}, completion: { (Bool) -> Void in
})

Basically it animates the label moving to a wrong place but after the animation finishes it suddenly jumps to the place I want it to go to.

What is causing this issue?


Solution

  • I had an animation inside another animation and it caused this issue. Now it is solved.