My aim is to make smooth animation started in the first view controller and end in the second view controller.
I'm experimenting with transition animation using object that conform to UIViewControllerAnimatedTransitioning
and UIViewControllerTransitioningDelegate
protocols.
I set up two view controllers (VC) in the storyboard and connect them with segue (default show). I also made unwind segue method in the first VC and set up a button for it in the second VC.
I have strange problem. My object have methods
func animationControllerForPresentedController(presented: UIViewController, presentingController presenting: UIViewController, sourceController source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
self.presenting = true
NSLog("start")
return self
}
func animateTransition(transitionContext: UIViewControllerContextTransitioning) {
if presenting {
NSLog("Animation Push")
transitionPush(transitionContext)
}
else {
NSLog("Animation Pop")
transitionPop(transitionContext)
}
}
I have two different methods for animation from first VC to second and from second to first VC.
When I activate segue I have very strange delay between animationControllerForPresentedController
and animateTransition
methods. Sometimes it can be about 1 second, and my whole transition animation must be 1 second plus this unexpected delay is too big.
Here is a log:
2015-02-08 19:52:33.528 MyApp[1318:119598] start
2015-02-08 19:52:33.979 MyApp[1318:119598] Animation Push
I don't know why this delay occur and if there a way to remove or reduce it? I tried to check if this could be my code, but I didn't find any prove of it. Feel free to ask for more info.