Newbie: how to add a top bar with buttons on a UITableViewController

I'm new to iOS development, I just have a UITableViewController in a storyboard. I would like to add to it the top bar with some buttons, how to do it?

Please note: I am using the UITabBar created by "Storyboard" and my ITableViewController is a single UITabBar element.

+7
source share
4 answers

When creating a UITableViewController do the following:

 UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:tableViewController]; 

and then instead of setting the table view controller as the view, install it on the navigation controller. Inside the table view controller, you can set the left and right buttons for the navigation bar on the UIBarButtonItem (ask me if you want to know how to do this).

+2
source

Select the UITableViewController and go to Editor> Paste In and select the navigation controller.

+2
source

You can look at using the UINavigationController. https://developer.apple.com/library/ios/DOCUMENTATION/UIKit/Reference/UINavigationController_Class/Reference/Reference.html

If you do not want to use the UINavigationController, then what you can do is create a view that has the β€œtop bar” you are looking for, and then add the UITableViewController view to your new UIView.

+1
source

You need to create a UIViewController , not a UITableViewController , and then place the elements you need (in this case, the table view and UIToolbar).

0
source

All Articles