2

我能够在我的 PhoneGap 项目中实现 childviewcontroller 的概念。现在,当我单击我的应用程序的任何链接时,它会成功在 childviewcontroller 中打开。

这是在 clildbrowser 中打开页面的行

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

现在我想将 childBrowser 作为 pushViewController 打开。目前它是从下到上的,但我希望它从左到右打开。

有什么办法吗?更换presentModalViewController失败pushViewController

4

1 回答 1

1

presentModalViewController 和 pushViewController 在概念上各不相同。如果您只需要更改动画,则可能需要执行以下操作:

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

或者干脆使用传统动画(代码需要调整):

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];
于 2012-05-15T06:55:36.207 回答