【问题标题】:Phonegap/iOS - how to push childviewcontroller?Phonegap/iOS - 如何推送 childviewcontroller?
【发布时间】:2011-12-05 07:52:54
【问题描述】:
我能够在我的 PhoneGap 项目中实现 childviewcontroller 的概念。
现在,当我单击我的应用程序的任何链接时,它会成功在 childviewcontroller 中打开。
这是在clildbrowser中打开页面的一行
[super.viewController presentModalViewController:childBrowser
animated:YES ];
现在我想将 childBrowser 作为 pushViewController 打开。目前它是从下到上的,但我希望它从左到右打开。
有什么办法吗?将 presentModalViewController 替换为 pushViewController 失败。
【问题讨论】:
标签:
ios
cordova
phonegap-plugins
pushviewcontroller
【解决方案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];