Reputation: 2488
In my iPhone app I'm using several modal views. When I present a new viewcontroller I always use one of the transition animations
(UIModalTransitionStylePartialCurl,UIModalTransitionStyleFlipHorizontal
UIModalTransitionStyleCoverVertical,UIModalTransitionStyleCrossDissolve)
What I am looking for would be called UIModalTransitionStyleCoverHorizontal
, but there's no such thing. However in a lot of applications (both ios and 3rd party) I see this horizontal covering transition.
Does anybody know how this can be achieved?
Upvotes: 3
Views: 7026
Reputation: 2488
I answer my question too. What @Max Justicz said is one way to do it. The other way is to have it done in a UINavigationController.
You create the UIViewController where you want to navigate from:
UIViewController* controller1 = [[UINavigationController alloc]init];
Also create a UINavigationController and init it with the controller
UINavigationController* controllerNVC = [[UINavigationController alloc]initWithRootViewController: controller1];
Then in "controller's .m" file when you want to navigate, do it like this.
UIViewController* controller2 = [[UINavigationController alloc]init];
[[self navigationController] pushViewController:controller2 animated:YES];
this will push a controller2 onto controller1.
When you want to go back from controller2 just call this:
[[self navigationController]popViewControllerAnimated:YES];
This way you can have a horizontalcover animated way to navigate between views
Upvotes: 2