I've been searching for an answer to this question and found a few answers for doing something similar in Obj-C, adding the toolbar to the appdelegate and so forth, but I was wondering if there was a better to do this in Swift so that the toolbar displays across all the VCs. A Swift version of this, or this for example. I found this question but no one has offered any answers so does that mean there's no better way in Swift? I haven't used toolbars much and I'm not experienced enough with Swift to know when something simply is or is not possible. Thanks for any help.
UINavigationController
s feature an optional UIToolbar
. Simply unhide it at the start of your first view controller (in viewDidLoad
for example) to have it display throughout your app, ex:
navigationController.toolbarHidden = false
You can subsequently set your toolbar's items within each view controller by adding items to the view controller's toolbarItems
property:
toolbarItems = itemsArray