Contents

viewWillDisappear(_:)

Notifies the view controller that its view is about to be removed from a view hierarchy.

Declaration

func viewWillDisappear(_ animated: Bool)

Parameters

  • animated:

    If True, the disappearance of the view is being animated.

Mentioned in

Discussion

This method is called in response to a view being removed from a view hierarchy. This method is called before the view is actually removed and before any animations are configured.

Subclasses can override this method and use it to commit editing changes, resign the first responder status of the view, or perform other relevant tasks. For example, you might use this method to revert changes to the orientation or style of the status bar that were made in the viewDidAppear(_:) method when the view was first presented. If you override this method, you must call super at some point in your implementation.

See Also

Responding to view-related events