我在 Split View中使用导航栏时遇到问题。我希望在我的 TableView 所在的左侧 View 中显示导航栏(参见图片 Click Here)。 这是我的 AppDelegate:
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
// create a new window instance based on the screen size
window = new UIWindow (UIScreen.MainScreen.Bounds);
this.masterViewController = new MasterViewControl();
this.detailViewController = new DetailViewController();
this.splitController = new UISplitViewController();
this.splitController.ViewControllers = new UIViewController[] {
this.masterViewController,
this.detailViewController
};
this.splitController.Delegate = new SplitControllerDelegate(this.detailViewController);
window.RootViewController = this.splitController;
// make the window visible
window.MakeKeyAndVisible ();
return true;
}
MasterViewController 正在尝试以这种方式使用它
'this.buttonAdd = new UIBarButtonItem("Edit", UIBarButtonItemStyle.Bordered, this.ButtonAdd_Clicked);
this.NavigationItem.SetRightBarButtonItem ( this.buttonAdd, true);'
请您参考如下方法:
您可能想尝试现有的解决方案,例如 MGSplitViewController。有可用的视频 here .
original source code ( objective-c )和 MonoTouch bindings可用。
或者您可以使用 MonoTouch/C# port来自 Krumelur,如果您想更改/更新代码库,它将更易于使用。
