MonoTouch向后导航(向右滑动)

时间:2012-06-06 22:18:32

标签: c# xamarin.ios

我有这个Swipe扩展方法:

View.Swipe(UISwipeGestureRecognizerDirection.Right).Event += (s, r) =>
        View.RemoveFromSuperview();

View.RemoveFromSuperview()使屏幕变为空白。我正在尝试回到上一个视图,我需要调用的命令/方法是什么?

我用当前视图推送:

AppDelegate.Current.NavController.PushViewController(new SingleIssueController(Item), true);

1 个答案:

答案 0 :(得分:3)

使用PopViewController,如果在“SingleIssueController”中发生这种情况,请将“AppDelegate.Current.NavController”作为参数传递,如下所示:

var nav = AppDelegate.Current.NavController;
nav.PushViewController (new SingleIssueController (Item, nav));

然后在您的SingleIssueController中,您可以附加到事件并弹出如下:

View.Swipe (....).Event += (s,r) => nav.PopViewControllerAnimated (true);