Called just before the view controller is added or removed from a container view controller.
- iOS 5.0+
- Mac Catalyst 13.0+Beta
- tvOS 9.0+
The parent view controller, or
nil if there is no parent.
Your view controller can override this method when it needs to know that it has been added to a container.
If you are implementing your own container view controller, it must call the
willMoveToParentViewController: method of the child view controller before calling the
removeFromParentViewController method, passing in a parent value of
When your custom container calls the
addChildViewController: method, it automatically calls the
willMoveToParentViewController: method of the view controller to be added as a child before adding it.
Responding to Containment Events
This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.Learn more about using Apple's beta software