Notifies the container that the size of its view is about to change.
Required.
SDKs
- iOS 8.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
Framework
- UIKit
Declaration
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIView Controller Transition Coordinator>)coordinator;
Parameters
size
The new size for the container’s view.
coordinator
The transition coordinator object managing the size change. You can use this object to animate your changes or get information about the transition that is in progress.
Discussion
UIKit calls this method before changing the size of a presented view controller’s view. You can override this method in your own objects and use it to perform additional tasks related to the size change. For example, a container view controller might use this method to override the traits of its embedded child view controllers. Use the provided coordinator
object to animate any changes you make.
If you override this method in your custom view controllers, always call super
at some point in your implementation so that UIKit can forward the size change message appropriately. View controllers forward the size change message to their views and child view controllers. Presentation controllers forward the size change to their presented view controller.