My goal is to make a smooth animation running in the first view controller and end in the second view controller.
I am experimenting with transition animations using an object that conforms to the UIViewControllerAnimatedTransitioning and UIViewControllerTransitioningDelegate . I installed two view controllers (VC) in the storyboard and connected them to segue (default display). I also made a segue unwind method in the first VC and set a button for it in the second VC.
I have a strange problem. My object has 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 animating from the first VC to the second and from the second to the first VC. When I activate segue, I have a very strange delay between the animationControllerForPresentedController and animateTransition . Sometimes it can be about 1 second and my entire transition animation should be 1 second plus this unexpected delay is too long. Here is the 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 do not know why this delay occurs and is there a way to remove or reduce it? I tried to check if this could be my code, but I did not find confirmation. Feel free to ask for more information.
ios iphone uiviewcontroller animation swift
Dima deplov
source share