Noah Gilmore wrote about his approach to use
UINavigationController inside a popover without subclassing the navigation controller. Even though I don’t work on iOS apps, like, at all these days, this sounds too useful to go by unnoticed.
Hopefully this was a helpful look into the world of preferredContentSize, view controller wrapping, and UIKit popovers. Here’s a tl;dr:
- To define the size of your popover with autolayout, set
preferredContentSizeto the result of
- To animate popover size updates at the same time as navigation controller animations, wrap your
PopoverPushController(see code below)
- When you change your controller’s
preferredContentSize, be sure to change the
preferredContentSizeof your controller’s
See NGPopoverForceResizeTest, the resulting sample app on GitHub.