Question

I use this code:

    CATransition *transition = [[CATransition alloc]init];
    transition.duration = 0.3;
    transition.type = kCATransitionMoveIn;
    transition.subtype= kCATransitionFromLeft;
    //transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];
    [self.navigationController.view.layer addAnimation:transition forKey:kCATransactionCompletionBlock];

And get visual blink at right of view. If I use kCATransitionFromRight I get blink at the left. I tested in simulator and on device. That is wrong?

Was it helpful?

Solution

use the bellow code and follow bellow instructions

  CATransition *navTransition = [CATransition animation];
    navTransition.duration = 0.65;
    navTransition.timingFunction = [CAMediaTimingFunction 
          functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
    [navTransition setType:kCATransitionReveal];
    [navTransition setSubtype:kCATransitionFromRight];
    [view.navigationController.navigationBar.layer 
          addAnimation:navTransition forKey:nil];

Here's a best way:

Create a UINavigationControllerDelegate for your UINavigationController. You'll get to hear about new views being pushed/popped onto the nav stack via one of the delegate methods such as navigationController:willShowViewController:animated:. In the appropriate delegate method you can set a property on your custom UIViewController so that it knows which animation to use in viewWillAppear etc.

OTHER TIPS

If deploy target is 7.0, use UINavigationControllerDelegate to customize push/pop animation.

It's little bit complicated, but it's very powerful. Whatever you imagine, you can do with these delegates.

- (id <UIViewControllerInteractiveTransitioning>)navigationController:(UINavigationController *)navigationController
                      interactionControllerForAnimationController:(id <UIViewControllerAnimatedTransitioning>) animationController NS_AVAILABLE_IOS(7_0);

- (id <UIViewControllerAnimatedTransitioning>)navigationController:(UINavigationController *)navigationController
                               animationControllerForOperation:(UINavigationControllerOperation)operation
                                            fromViewController:(UIViewController *)fromVC
                                              toViewController:(UIViewController *)toVC  NS_AVAILABLE_IOS(7_0);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top