简体   繁体   中英

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 ). This is my 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

'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 . There's a video of it available here .

The original source code (objective-c) and MonoTouch bindings are available.

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.

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