18

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?

Mauricio Zambon
  • 695
  • 2
  • 9
  • 17

4 Answers4

58

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.

Fernando Madruga
  • 1,746
  • 13
  • 11
5

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

malhal
  • 26,330
  • 7
  • 115
  • 133
4

try this

self.navigationController.toolbarHidden=NO;
slonkar
  • 4,055
  • 8
  • 39
  • 63
2

In the show the size inspector in the field autosizinf choose to bind to the top of the screen and remove the binding to the bottom of the screen.

Qantas 94 Heavy
  • 15,750
  • 31
  • 68
  • 83