Skip to content
Demonstrates how a popover containing a navigation controller can resize itself dynamically, animating resize and push at the same time.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

How do I animate the resizing of UIPopoverController containing a UINavigationController based on the sizes of the view controllers being pushed?

Normally, setting preferredContentSize on a view controller you want to present with a UIPopoverController is enough to trigger the popover's animated resize.

However when presenting a UINavigationController in a popover, setting preferredContentSize causes the resize animation to be performed after the push transition (see kylesluder/PopoverSizing).

The solution is to use view controller containment wrap the UINavigationController in a containing UIViewController (i.e. make UINavigationController), which we then manipulate the preferredContentSize of. We can make sure this is done every time a view controller is pushed by supplying a delegate to the navigation controller.

See MESViewController.m for more details.

You can’t perform that action at this time.