Note that there are some explanatory texts on larger screens.

plurals
  1. POModal UINavigationController with UIToolbar - Toolbar remains empty
    text
    copied!<p>I'm trying to put a simple UIToolbar at the bottom of a modally presented UINavigationController. In this sample, it should contain two buttons "cancel" and "something".</p> <pre><code>... UINavigationController modalNavigationController = new UINavigationController(someViewController); modalNavigationController.NavigationBar.BarStyle = UIBarStyle.Black; modalNavigationController.Toolbar.BarStyle = UIBarStyle.Black; modalNavigationController.ToolbarHidden = false; UIBarButtonItem cancelButton = new UIBarButtonItem("cancel", UIBarButtonItemStyle.Plain, delegate { modalNavigationController.DismissModalViewControllerAnimated(true); }); UIBarButtonItem flexSpace = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace, null); UIBarButtonItem someButton = new UIBarButtonItem("something", UIBarButtonItemStyle.Plain, delegate { Console.WriteLine("here we are!"); }); modalNavigationController.ToolbarItems = new UIBarButtonItem[] { cancelButton, flexSpace, someButton }; parentController.PresentModalViewController(modalNavigationController, true); ... </code></pre> <p>The toolbar appears and has black style (as assigned), it does not contain any items though. I've tried assigning the items before setting hidden to false, no effect. I also tried using Toolbar.Items and Toolbar.Hidden as well as SetToolbarItems() and SetToolbarHidden() instead, with no luck.</p> <p>Any hints on what might be wrong here? Thanks</p> <p><strong>EDIT:</strong><br> Most samples on the net create their own UIToolbar and add it as a subview. That is not required with a UINavigationController, right? AFAICT, it has one built-in.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload