Xamarin.ios 单触式拆分视图示例无法更改ViewController

Xamarin.ios 单触式拆分视图示例无法更改ViewController,xamarin.ios,Xamarin.ios,我正在尝试学习如何使用UISplitViewController,我正在使用Monotouch提供的“SplitView”示例。我了解它是如何工作的,以及主控制器和详细控制器之间的通信 因此,更改细节控制器不会很难吗?所以我做了一个很小的修改,但它不起作用!我已经了解到您必须使用SetViewController,但Monotouch堆栈中不存在这种情况。我哪里做错了 它与Montouch中的示例代码完全相同,除了以下几行: public class MainSplitView : UISpli

我正在尝试学习如何使用UISplitViewController,我正在使用Monotouch提供的“SplitView”示例。我了解它是如何工作的,以及主控制器和详细控制器之间的通信

因此,更改细节控制器不会很难吗?所以我做了一个很小的修改,但它不起作用!我已经了解到您必须使用SetViewController,但Monotouch堆栈中不存在这种情况。我哪里做错了

它与Montouch中的示例代码完全相同,除了以下几行:

public class MainSplitView : UISplitViewController
{       
    protected Screens.MasterView.MasterTableView masterView;
    protected Screens.DetailView.DetailViewScreen detailView;
    protected TestViewController testViewController; // *** Added this line

    public MainSplitView () : base()
    {
        // create our master and detail views
        masterView = new Screens.MasterView.MasterTableView ();
        detailView = new Screens.DetailView.DetailViewScreen ();

        masterView.RowClicked += (object sender, MasterView.MasterTableView.RowClickedEventArgs e) => 
        {
            detailView.Text = e.Item;

            testViewController = new TestViewController();  // *** Added this line
            ViewControllers[0] = masterView;         // *** Added this line
            ViewControllers[1] = testViewController; // *** Added this line
          // the UISplitViewController.SetViewControllers does not exist! ???
        };

         ViewControllers = new UIViewController[] { masterView, detailView };

     }
非常感谢大家的帮助


Mike

设置
视图控制器
您在其他位置的具体操作方法:

ViewControllers = new UIViewController[] { masterView, detailView };
只要这样做:

ViewControllers = new UIViewController[] { masterView, testViewController };

设置
ViewControllers
您在其他位置的具体操作方法:

ViewControllers = new UIViewController[] { masterView, detailView };
只要这样做:

ViewControllers = new UIViewController[] { masterView, testViewController };

工作得很好!很明显,我看不见树林,看不见树木。谢谢,很好!很明显,我看不见树林,看不见树木。谢谢