Phonegap/iOS - how to push childviewcontroller?
-
28-10-2019 - |
Question
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.
Solution
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];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow