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.