I made a custom transition in UINavigationController, code I used:
SecondView *newView = [[SecondView alloc] initWithNibName:nil bundle:nil];
[UIView beginAnimtaions:nil context:nil];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown];
[self.navigationcontroller pushViewController:newView animated:NO];
[UIView commitAntimations];
[newView release];
But that transition animation applies only on Forward, can I apply it on Back?
Thanks
Of course, simply define a custom UIBarButtonItem for back button and link it to a custom method that do something similar you do to push the controller, but instead of pushing you'll need to pop the view controller.
i.e. first you create your back button (in init or viewDidLoad method)
UIBarButtonItem *backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Done" style:UIBarButtonItemStyleDone target:self action:@selector(back)];
self.navigationItem.leftBarButtonItem = backBarButtonItem;
[backBarButtonItem release];
then, in your back method, you can do your custom animation
-(IBAction)back {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration: 1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.navigationController.view cache:YES];
[[self navigationController] popViewControllerAnimated:NO];
[UIView commitAnimations];
}
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