可能重复:
How to change the Push and Pop animations in a navigation based app
使用MonoTouch和MonoTouch.Dialog,我有DialogViewController
我正在推动 UINavigationController
,当我这样做时,它会使当前显示的屏幕从右向左移动。我想知道如何逆转它,让当前屏幕从左到右“推开”,就像按下后退按钮一样。
我的代码如下,其中_root是RootElement。
_viewController = new DialogViewController(_root, false);
_navController.PushViewController(_viewController, true);
编辑:我尝试使用_viewController.ModalTransitionStyle,如果这些信息有帮助,这样做无济于事。
答案 0 :(得分:3)
您可以通过搜索Stack Overflow找到答案。比如这里: How to change the Push and Pop animations in a navigation based app
MainView *nextView = [[MainView alloc] init];
[UIView animateWithDuration:0.75
animations:^{
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[super pushViewController:nextView animated:NO];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.navigationController.view cache:NO];
}];
这很容易在MonoTouch中翻译,并且会变成(未经测试):
UIView.Animate(0.75f, 0f, UIViewAnimationOptions.CurveEaseIn, delegate {
navController.PushViewController(...);
UIView.SetAnimationTransition(UIViewAnimationTransition.FlipFromRight, navController.View, false);
}, null);