C# 在MonoTouch.Dialog中,每个根元素都有一个专用的UIViewController?

C# 在MonoTouch.Dialog中,每个根元素都有一个专用的UIViewController?,c#,ios,xamarin.ios,monotouch.dialog,C#,Ios,Xamarin.ios,Monotouch.dialog,使用MonoTouch.Dialog中的嵌套RootElements可以轻松创建多级菜单结构,但是如何让特定的UIViewController管理每个根目录呢?我希望每个RootElement都有自己的UIViewController的原因是因为我希望能够轻松控制背景图像和在屏幕之间切换导航栏之类的事情,而在UIViewController中这样做很繁琐,我想您正在寻找这一点: public RootElement (string caption, Func<RootElement, UI

使用
MonoTouch.Dialog
中的嵌套
RootElements
可以轻松创建多级菜单结构,但是如何让特定的
UIViewController
管理每个根目录呢?我希望每个
RootElement
都有自己的
UIViewController
的原因是因为我希望能够轻松控制背景图像和在屏幕之间切换导航栏之类的事情,而在
UIViewController

中这样做很繁琐,我想您正在寻找这一点:

public RootElement (string caption, Func<RootElement, UIViewController> createOnSelected)
接下来,使用以下命令创建根元素:

    var root_element = new RootElement ("caption", CreateFromRoot);
上述内容将为您提供与以下内容相同的信息:

    var root_element = new RootElement ("caption");

除了您现在可以根据自己的喜好定制
对话框viewcontroller
,然后再返回它。

同样的事情,更少的方法

    var root_element = new RootElement("caption", (RootElement e) => {
        return new DialogViewController (e);
    });

createOnSelected的代码是什么样子的?另外,这里有“public”,你是说“new”吗?不,上面是应该在代码中使用的构造函数声明(来自MonoTouch.Dialog)(通过执行一个新的操作)。我将更新答案以显示这一点。
    var root_element = new RootElement("caption", (RootElement e) => {
        return new DialogViewController (e);
    });