iPad: add a popover view on Navigation Bar

In your app delegate, have property for the current ViewController class:

Then in our didFinishLaunchingWithOptions method, we allocate this main ViewController, which we will insert into a newly created UINavigationController variable. We create this new UINavigationController below:

This way, our root is this navigation controller. And the navigation controller’s first page is our view controller.

View Controller

ViewController.h

Run the demo and you should have a yellow popover window appear.
Now let’s put a table that has 3 colors to choose from in there instead.

The key is that we create a viewcontroller that extends from UITableViewController. when the table view controller gets a click on a entry, it sends its corresponding UI uiviewcontroller messages via a delegate.

ColorPickerDelegate and ColorPickerTableViewController

Go Back to your ViewController and change/add the following methods:

Leave a Reply