iOS Developer Library — Prerelease


UIKit Framework Reference UIAdaptivePresentationControllerDelegate Protocol Reference

Deployment Target:

On This Page


An object that conforms to the UIAdaptivePresentationControllerDelegate protocol works with a presentation controller to determine how to respond to trait changes in your app. Your delegate can suggest a new presentation style or an entirely new view controller for displaying content.

After implementing an object that conforms to this protocol, assign that object to the delegate property of an appropriate UIPresentationController object. For more information about using the delegate to respond to size class changes, see UIPresentationController Class Reference.

  • Asks the delegate for the view controller to display when adapting to the specified presentation style.



    optional func presentationController(_ controller: UIPresentationController, viewControllerForAdaptivePresentationStyle style: UIModalPresentationStyle) -> UIViewController?


    - (UIViewController *)presentationController:(UIPresentationController *)controller viewControllerForAdaptivePresentationStyle:(UIModalPresentationStyle)style



    The presentation controller that is managing the size class change.


    The new presentation style that is about to be employed to display the view controller.

    Return Value

    The view controller to display in place of the existing presented view controller.


    When a size class change causes a change to the underlying presentation style, the presentation controller calls this method to ask for the view controller to display in that new style. This method is your opportunity to replace the current view controller with one that is better suited for the new presentation style. For example, you might use this method to insert a navigation controller into your view hierarchy to facilitate pushing new view controllers more easily in the compact environment. In that instance, you would return a navigation controller whose root view controller is the currently presented view controller. You could also return an entirely different view controller if you prefer.

    If you do not implement this method or your implementation returns nil, the presentation controller uses its existing presented view controller.


    Available in iOS 8.0 and later.