简体   繁体   中英

Monotouch SplitView changing the details view

please forgive the newness level I'll be exhibiting.

I created a new iPad Master/Detail ( UISplitViewController ) app in Monotouch. The master controller on the left is a UITableViewController . The detail on the right is just a UIViewConroller . These are loaded by default in the AppDelegate code.

In the master controller I then added some items to the table and overrode the RowSelected() event and that works great, so I can get the item selected. I've added an additional UIViewController ( DetailViewController2 ) that I want to display on the right side of the screen when an item is selected in the table. It really doesn't matter which item, I just want to change the contents of the right side where the DetailViewController is to the DetailViewController2 . I've tried a lot of things and nothing working -- I know this should be obvious, but I'm lost.

Thanks for any help.

If you are using UISplitViewController , the way to change the master and detail controller is to update the ViewControllers property. It always wants both, the master and the detail controller. If you want to update the detail only, your code would be something like this:

var masterController = splitController.ViewControllers[0];
var newDetailController = new DetailViewController2();
splitController.ViewControllers = new UIViewController[] { masterController, newDetailController };

For Documentation see here: http://developer.apple.com/library/ios/#documentation/uikit/reference/UISplitViewController_class/Reference/Reference.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM