I am trying to restore my animation on a UINavigationController based app.
In viewWillAppear
I do the following:
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
self.animateButtons()
}
I have also added these:
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(addAnimation), name: UIApplicationDidBecomeActiveNotification, object: nil)
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(restorePosition), name: UIApplicationDidEnterBackgroundNotification, object: nil)
And this is my start/restore animation:
func addAnimation() {
self.animateButtons()
}
func restorePosition() {
self.restoreToOriginalPosition()
}
So to explain: When controller is loaded I create my buttons self.makeRoundQButtons
in my viewDidLoad
. Then I animate in viewWillAppear
.
Then when entering background I restore their original position self.restoreToOriginalPosition()
and I animate them again once active func addAnimation() {...}
...
Now this works fine on the "active" view. When I "drill" down on my Navigation Tree, enter background and active again, and use the "back" button to navigate to any "previous" view(s) although viewWillAppear
is called NO animation happens. If I move forward and then back again everything works fine...
What am I doing wrong?
Aucun commentaire:
Enregistrer un commentaire