A set of methods for adapting the contents of your view controllers to size and trait changes.
SDKs
- iOS 8.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
Framework
- UIKit
Declaration
protocol UIContentContainer
Overview
The methods of this protocol handle size-related transitions that are related to changes in the current trait environment or view controller hierarchy. When the parent view controller changes, or when trait changes occur that affect the size of a view controller, UIKit calls these methods to give the affected objects a chance to respond appropriately.
All UIView
and UIPresentation
objects provide default implementations for the methods of this protocol. When creating your own custom view controller or presentation controller, you can override the default implementations to make adjustments to your content. For example, you might use these methods to adjust the size or position of any child view controllers.
When overriding the methods of this protocol, call super
to let UIKit perform any default behaviors. View controllers and presentation controllers perform their own adjustments when these methods are called. Calling super
ensures that UIKit is able to continue adjusting other parts of your user interface.