I am pushing my view controller with the following statement :
[[self navigationController] pushViewController:self.customViewController animatedWithTransition:UIViewAnimationTransitionFlipFromLeft];
Now when I am pressing the back button I want to animate it with the uiviewanimationtransitionflipfromright .
like
[self.navigationController popViewControllerAnimatedWithTransition:UIViewAnimationTransitionFlipFromLeft];
How Can I do so ?
Thanks
This helps you to animating the view in back button.
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:0.75];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.navigationController.view cache:NO];
[UIView commitAnimations];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDelay:0.375];
[self.navigationController popViewControllerAnimated:NO];
[UIView commitAnimations];
For Push:
MainView *nextView = [[MainView alloc] init];
[UIView animateWithDuration:0.75
animations:^{
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[self.navigationController pushViewController:nextView animated:NO];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.navigationController.view cache:NO];
}];
For Pop:
[UIView animateWithDuration:0.75
animations:^{
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.navigationController.view cache:NO];
}];
[self.navigationController popViewControllerAnimated:NO];
https://stackoverflow.com/a/5889757/1915820
See here for doing custom back anim:
Prevent the animation when clicking "Back" button in a navigation bar?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With