Contents

willRotate(to:duration:)

Sent to the view controller just before the user interface begins rotating.

Declaration

func willRotate(to toInterfaceOrientation: UIInterfaceOrientation, duration: TimeInterval)

Parameters

  • toInterfaceOrientation:

    The new orientation for the user interface. The possible values are described in Uiinterfaceorientation.

  • duration:

    The duration of the pending rotation, measured in seconds.

Discussion

Subclasses may override this method to perform additional actions immediately prior to the rotation. For example, you might use this method to disable view interactions, stop media playback, or temporarily turn off expensive drawing or live updates. You might also use it to swap the current view for one that reflects the new interface orientation. When this method is called, the interfaceOrientation property still contains the view’s original orientation. Your implementation of this method must call super at some point during its execution.

This method is called regardless of whether your code performs one-step or two-step rotations.

See Also

Deprecated methods