[英]Can't show NavigationBar on SplitView MonoTouch
I have a problem using an navigation bar on my split view. 我在拆分视图上使用导航栏时遇到问题。 I want the navigationbar showing on the left view there my TableView is (see picture Click Here ). 我希望导航栏显示在TableView的左侧视图中(请参阅图片单击此处 )。 This is my AppDelegate: 这是我的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;
}
And the MasterViewController im trying to use it this way 和MasterViewController我试图以这种方式使用它
'this.buttonAdd = new UIBarButtonItem("Edit", UIBarButtonItemStyle.Bordered, this.ButtonAdd_Clicked);
this.NavigationItem.SetRightBarButtonItem ( this.buttonAdd, true);'
You might want to try an existing solution, like MGSplitViewController
. 您可能想尝试现有的解决方案,例如MGSplitViewController
。 There's a video of it available here . 还有它提供的视频在这里 。
The original source code (objective-c) and MonoTouch bindings are available. 原始源代码 (objective-c)和MonoTouch 绑定可用。
Or you can use a MonoTouch/C# port from Krumelur, which will be easier to use if you want to change/update the code base. 或者,您可以使用Krumelur的MonoTouch / C#端口 ,如果您要更改/更新代码库,它将更易于使用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.