1
votes

I have a navigation based application and I want to change the animation of the push and pop animations. How would I do that?

When i push any viewController it represent as pop and When i pop any viewController it represent as push.

2
As of iOS 7, there is official API for this; see UINavigationControllerDelegate's custom transition animation support. There's also a WWDC 2013 Video about this. From here you'll have to look into if it supports ios8 ect.Darcey Mckelvey
have a look at this question stackoverflow.com/questions/1406037/…Eager Logic

2 Answers

2
votes
   CATransition *transition = [CATransition animation];
    transition.duration = 0.3f;
    transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
    transition.type = kCATransitionPush;
        transition.subtype=kCATransitionFromRight;
    kCATransitionFromLeft   or  kCATransitionFromRight
    [self.navigationController.view.layer addAnimation:transition forKey:nil];

add this before you push the view controller for custom animation

1
votes
-(void)pushViewController:(UIViewController *)viewController{

    float width = self.frame.size.width;
    float height = self.frame.size.height;

    [viewController.view setFrame:CGRectMake(width, 0.0, width, height)];
    [self addSubview:viewController.view];   
    [UIView animateWithDuration:0.33f
                          delay:0.0f
                        options:UIViewAnimationOptionCurveEaseInOut | UIViewAnimationOptionAllowUserInteraction
                     animations:^{
                         [viewController.view setFrame:self.frame];
                         [self setFrame:CGRectMake(0.0, 0.0, width, height)];
                     }
                     completion:^(BOOL finished){

                     }];

}