IOS Swift Animation - moving an image to a new position

I am trying to implement this cool feature where the logo moves a little after loading the application and the login window appears. The problem is that when I use this code:

override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
        UIView.animateWithDuration(2, animations: {
            var newCenter = self.logoImage.center
            newCenter.y -= 100
            self.logoImage.center = newCenter
            }, completion: { finished in
                println("Basket doors opened!")
        })
    }

The logo moves to its original location from where I want to move it. So, in this example, the logo appears already with (y-100), and then moves to the beginning of X, Y.

+4
source share
1 answer

/ viewDidLoad(), - . , , viewDidAppear(animated: Bool). , newCenter var , self.logoImage.center = newCenter .

+9

All Articles