Luiz Luiz - 6 months ago 53
Swift Question

Slide label down

I'm building a game where I want a label to slide down. I watched this video where it works just fine, but it doesn't work on my project, it (firstLabel) just disappears and appears in the expected coordinate.

UIView.animateWithDuration(0.5, delay: 0.0, usingSpringWithDamping: 0.9, initialSpringVelocity: 0.0, options: [], animations: {

self.firstLabel.position = CGPoint(x: self.frame.width / 1.125, y: self.frame.height / 3)

}, completion: nil)

Ps: firstLabel was declared as


I think you're confusing your frameworks. You use UIView animation blocks to animate UIViews, not SpriteKit nodes. What you're looking for is SKAction.

        CGPoint(x: self.frame.width / 1.125, y: self.frame.height / 3),
        duration: 0.5