无法在SplitView MonoTouch上显示NavigationBar

时间:2012-02-01 08:30:00

标签: c# ios uinavigationcontroller xamarin.ios uisplitviewcontroller

我在拆分视图上使用导航栏时遇到问题。我希望导航栏在左侧视图中显示我的TableView(参见图片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);'

1 个答案:

答案 0 :(得分:4)

您可能想尝试现有的解决方案,例如MGSplitViewController。有一个可用的视频here

original source code(objective-c)和MonoTouch bindings可用。

或者您可以使用Krumelur的MonoTouch/C# port,如果您想更改/更新代码库,这将更容易使用。