我正在尝试学习如何使用 UISplitViewController,并且我正在使用 Monotouch 提供的“SplitView”示例。我了解它是如何工作的以及在 Master 和 Detail 控制器之间进行通信的方式。
因此更改细节控制器不会很难吗?所以我做了一个很小的修改,它不起作用!我已阅读您必须使用 SetViewControllers 但这在 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 };
}
非常感谢所有帮助!
麦克风