Vaibhav Saran
Vaibhav Saran

Reputation: 12908

Phonegap/iOS - how to push childviewcontroller?

I'm able to implement the concept of childviewcontroller in my PhoneGap project. Now when I click on any link of my app, that opens in childviewcontroller successfully.

Here is a line that opens the page in clildbrowser

[super.viewController presentModalViewController:childBrowser
animated:YES ];

Now I want to open childBrowser as a pushViewController. Currently it comes from bottom to top but i want this to open from left to right.

Is there any way? Replacing presentModalViewController to pushViewController fails.

Upvotes: 2

Views: 1485

Answers (1)

BigBalli
BigBalli

Reputation: 817

presentModalViewController and pushViewController ar every different in concept. If you just need to change the animation, you might want to do something like this:

childBrowser.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
//childBrowser.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
//childBrowser.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
//childBrowser.modalTransitionStyle = UIModalTransitionStylePartialCurl;
[super.viewController presentModalViewController:modalViewController
                                           animated:YES];

or simply use traditional animations (code needs adapting):

UIViewController *controller = [[[MyViewController alloc] init] autorelease];
UIViewAnimationTransition trans = UIViewAnimationTransitionCurlUp;
[UIView beginAnimations: nil context: nil];
[UIView setAnimationTransition: trans forView: [self window] cache: YES];
[navController presentModalViewController: controller animated: NO];
[UIView commitAnimations];

Upvotes: 1

Related Questions