Thursday, 22 August 2013

Adding Popover to current Navigation Controller heirarchy

Adding Popover to current Navigation Controller heirarchy

I've seen a lot of other questions on here about adding a UINavigationBar
to a UIPopoverController. All of the examples I've seen follow one of two
patterns:
In the init or viewDidLoad method of the Popover subclass, you alloc-init
a UINavigationBar directly, as suggested here. This method is a little
hacky, and while it shows up nicely, if the popover is a
UITableViewController, you have to mess with a bunch of things to make
sure the navigation bar you just added doesn't overlap one of your cells.
Alternatively, a lot of post suggest creating a UINavigationController
just before presenting the popover, as shown here.
With the second method, however, won't the popover be the only controller
in the newly created navigation controller? And if my view that I'm
presenting the popover from is itself already in a navigation controller,
the popover will NOT be in that same navigation controller, correct? It
seems to be that the more appropriate thing to do would be to add the
popover being created as another controller in the navigation controller
that already exists (and which the controller that presents the popover is
already a part of). Is that possible? Or is there a reason why the
navigation controller for the popover needs to be independent from the
navigation controller for the presenting controller? Or am I totally
missing something here?

No comments:

Post a Comment