How can I use the Top Bar setting of a UITableViewController in IB?

1.8k views Asked by At

I have a .xib with a controller, a UITableViewController. It contains a UITableView, which is controlled by the right .h, .m files and IBOutlets. All works fine, but I want a Navigation Bar on top of the view. Now I saw this setting in Interface Builder, which is in the Attributes window of the UITableViewController: "Top Bar". I set this to Navigation Bar, which nicely renders an empty navigation bar above the table view.

But I don't see it on my iPhone! How can I access this navigation bar, set its title and an edit button? Do I have to connect it to an outlet somewhere? I tried to add a navigation bar manually, but that doesn't work since its a UITableView.

Can someone help me out? Any advice is greatly appreciated.

1

There are 1 answers

1
Johannes Fahrenkrug On BEST ANSWER

The "Top Bar" option in IB is only to simulate what your UI would look like with a Navigation Bar. To actually see a navigation bar, you'll have to embed your UIViewController within a UINavigationController.

To find out how that works, check out the "Navigation-based Application" template in Xcode and check this out: http://www.matthewcasey.co.uk/2010/05/23/tutorial-introducing-uinavigationcontroller-part-1/