Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Beginner: How to add top bar with buttons on UITableViewController

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

Notice, I'm using UITabBar that is created by "Storyboard" and my ITableViewController is one item of the UITabBar.

like image 240
user836026 Avatar asked Feb 23 '12 15:02

user836026


1 Answers

When you create the UITableViewController, do the following:

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

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

like image 79
jrtc27 Avatar answered Oct 20 '22 01:10

jrtc27