RubberDucky4444 RubberDucky4444 - 5 months ago 11x
Swift Question

Swift animation not resetting when navigating back to that view

I have two views and when you go from view 1 to view 2 through tapping of a button the buttons all animate off screen. If you leave the 2nd page and go back to the first page the elements are all still off screen. Is there a way to have those elements get put back to their original positions in the background after the transition?

This is an example of one of the animations

func loggedInAnimate5(){

delay: 1.2,
options: .CurveEaseIn,
animations: { += self.view.bounds.height
self.logo.alpha = 0.0

}, completion: nil



In viewDidDisappear just set the position and alpha value back to where they were initially.


override func viewDidDisappear(animated: Bool) { = 100.0
    self.logo.alpha = 1.0