MonoTouch.Dialog中的每个RootElement都有一个专用的UIViewController?

MonoTouch.Dialog使用嵌套的RootElements创build多级菜单结构很容易,但是如何才能让特定的UIViewControllerpipe理每个根呢? 我希望每个RootElement拥有它自己的UIViewController的原因是我想要能够轻松地控制背景图像和从屏幕切换到屏幕导航条,这样做是在UIViewController内部进行的。

我想你正在寻找这个:

 public RootElement (string caption, Func<RootElement, UIViewController> createOnSelected) 

让您创buildUIViewController (例如,您自定义的DialogViewController或从其inheritance的types)。

这将让你继续嵌套你的Element同时给予大部分的视图控制,它是控制器。

UPDATE

以下是如何使用这个:

首先声明你的方法,将创buildUIViewController。 方法签名必须匹配Func<RootElement, UIViewController> ,例如

  static UIViewController CreateFromRoot (RootElement element) { return new DialogViewController (element); } 

接下来使用以下命令创build根元素

  var root_element = new RootElement ("caption", CreateFromRoot); 

以上会给你一样的:

  var root_element = new RootElement ("caption"); 

除非您现在可以在返回之前自定义DialogViewController

同样的事情,less些方法…

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