Instance Method

adaptivePresentationStyle(for:traitCollection:)

Asks the delegate for the presentation style to use when the specified set of traits are active.

Declaration

optional func adaptivePresentationStyle(for controller: UIPresentationController, traitCollection: UITraitCollection) -> UIModalPresentationStyle

Parameters

controller

The presentation controller that is managing the size change. Use this object to retrieve the view controllers involved in the presentation.

traitCollection

The traits representing the target environment. Use these traits to determine

Return Value

Discussion

The presentation controller calls this method when the traits of the current environment are about to change. Your implementation of this method can return the preferred presentation style to use for the specified traits. If you do not return one of the allowed styles, the presentation controller uses its preferred default style.

If you do not implement this method in your delegate, UIKit calls the adaptivePresentationStyle(for:) method instead.

See Also

Adapting the Presentation Style