Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS - Toolbar not showing

Using the storyboard I created a new screen for a second View controller and added a Toolbar at the bottom. But when the view is shown, the toolbar doesn't appear. I'm using Segue to change views.

What could be wrong?

like image 564
Mauricio Zambon Avatar asked Feb 13 '12 23:02

Mauricio Zambon


People also ask

Where is my tool bar on my Iphone?

In iOS, a toolbar appears at the bottom of a screen. iOS toolbars aren't customizable, and they don't support grouping. In iPadOS and macOS, a toolbar appears at the top of a screen or window. Both platforms support customizable toolbars and grouped toolbar items.

How do I add a toolbar to SwiftUI?

Toolbar items in the bottom bar As we can see in the example, SwiftUI provides the toolbar modifier that we can use to add toolbar items. A ToolbarItem has two required parameters. The first one is the placement and the second one is a closure to build the view that represents our action. Toolbar items in bottom bar.


2 Answers

If you're using a Navigation Controller, make sure to tick "Shows Toolbar" and add the buttons there, not on a standalone toolbar.

In order to show only on some, you'll need 2 different views, one that will hide it and another that won't and add the following to the respective view's viewWillAppear:

    self.navigationController.toolbarHidden = YES;

(Set to YES to hide, NO to show)

You can play around with the Simulated Metrics on the Storyboard so as to visually simulate the run-time effect by setting Bottom Bar to either None or Toolbar instead of inferred, as appropriated.

EDIT: Check this sample project I made.

like image 67
Fernando Madruga Avatar answered Oct 18 '22 20:10

Fernando Madruga


Select the Navigation Controller in the storyboard. Under Bar Visibility, check "Shows Toolbar".

like image 5
malhal Avatar answered Oct 18 '22 20:10

malhal