The mistake I made was to add a UINavigationBar
, which was added behind the existing UINavigationBar
and because of this all of its items were invisible!
A UINavigationBar
that was automatically added by a UINavigationController
doesn't show up in the hierarchy! There'll be one if there's a "back" button, so in this case add a UINavigationItem
instead. This creates a Title
item.
Drag the new item you want to add over the left or right side of the UINavigationBar
and there'll be a blue square, indicating where you can drop it. This item can be a UIBarButtonItem
(which can be linked up like a button), a UIButton
(which automatically also creates a UIBarButtonItem
),... or even a UIView
. Dropping an item adds it to the hierarchy and if it's the very first one, two new children are also going to be added to the Title
:
- Left Bar Button Items
- Right Bar Button Items
Important: Adding something to the left "drop zone" overwrites the "back" button, which means that you're going to have to deal with going back to the previous screen yourself. This is easily accomplished by creating an "onClick" action for this item (ctrl+drag to the .swift file) and then calling:
navigationController?.popViewController(animated: true)