我有一个视图让用户编辑EntryElement
. 我通过“完成”按钮的委托很好地注册了单击事件,但是,我无法让它关闭当前视图以转到上一个视图。这是我现在正在尝试的:
AppDelegate.navigation.PresentedViewController.DismissViewController(true, null);
我也试过:
AppDelegate.navigation.PresentedViewController.RemoveFromParentViewController();
navigation
只是一个UINavigationController
编辑:
我正在使用Monotouch.Dialog
构建所有视图。这个视图是通过一个方法创建的。一旦他们单击完成按钮,我希望它返回到上一个视图。下面是方法的内容:
public static void EditClientTypeView (string typeName, string typeId)
{
DialogViewController editClientTypeVC;
UIBarButtonItem doneButton = new UIBarButtonItem (UIBarButtonSystemItem.Done);
EntryElement element = new EntryElement("Type Name", "Name of client type", typeName, false);
var root = new RootElement ("Edit Type") {
new Section () {
element
}
};
editClientTypeVC = new DialogViewController (root, true);
editClientTypeVC.NavigationItem.RightBarButtonItem = doneButton;
doneButton.Clicked += (sender, e) => {
// Need to save the edited client type to the database
Console.WriteLine("Done button clicked signifying the user is finished editing");
AppDelegate.navigation.PresentedViewController.RemoveFromParentViewController();
//AppDelegate.navigation.DismissViewController(true, null);
};
AppDelegate.navigation.PushViewController(editClientTypeVC, true);
}
任何帮助表示赞赏!