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.
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.
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
-(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){
}];
}