0

イベント(Tapped for String要素など)に戻るにはどうすればよいですか?プログラムで

Section s =  someelement.Parent as Section;
RootElement re =  s.Parent as RootElement;
// how to get to DialogViewControler or something to navigate back?

ありがとう

メル

4

2 に答える 2

0

ここではかなり新しいですが、それを行うためにを使用したくないですNavigationControllerか?DialogViewControllerあなたはあなたのイベントが実施されている場所の中にいると思いますか?だからあなたはただすることができます:

this.NavigationController.PopViewControllerAnimated(true);
于 2012-09-20T22:25:49.100 に答える
0

DVCがNavController内にある場合、Baramuseの答えは機能します。しかし、MTD はナビゲーション コントローラー スタイルとモーダル ダイアログ スタイルの両方で機能します。MTD にその作業を任せたほうがよいでしょう (そのため、将来何か変更があったとしても、コードは引き続き機能します)。DialogViewControllerメソッドのみを提供します:

    /// <summary>
    /// Dismisses the view controller.   It either pops or dismisses
    /// based on the kind of container we are hosted in.
    /// </summary>
    public void DeactivateController (bool animated)
    {
        var parent = ParentViewController;
        var nav = parent as UINavigationController;

        if (nav != null)
            nav.PopViewControllerAnimated (animated);
        else
            DismissModalViewControllerAnimated (animated);
    }
于 2012-09-21T00:59:57.330 に答える