Delete My Account
Delete My Account

Reputation: 785

Adding a Toolbar to a UITableViewController Using Swift

I wish to add a toolbar to the bottom of a tableview. In this stackoverflow post I learned that "If your UITableViewController is embedded in UINavigationController, the navigation controller comes with a toolbar. You wouldn't need to add your own.". The author of that post proceeds to lists the objective-c code to make it visible. Could I please be directed to a tutorial or example which demonstrates the swift code that will to the same thing? I am new to iOS apps and Xcode, learning it as I go.

Upvotes: 3

Views: 3942

Answers (1)

Dean
Dean

Reputation: 1542

To make the toolbar visible, simply use this function in the viewDidLoad :

self.navigationController!.setToolbarHidden(false, animated: true)

To populate with items, you have the setToolbarItem function :

self.navigationController!.setToolbarItems(<toolbarItems: [AnyObject]?>, animated: <Bool>)

Here is the link for the UINavigationController class reference

Upvotes: 5

Related Questions