Protocol

UIViewControllerAnimatedTransitioning

A set of methods for implementing the animations for a custom view controller transition.

Declaration

@protocol UIViewControllerAnimatedTransitioning

Overview

The methods in this protocol let you define an animator object, which creates the animations for transitioning a view controller on or off screen in a fixed amount of time. The animations you create using this protocol must not be interactive. To create interactive transitions, you must combine your animator object with another object that controls the timing of your animations.

In your animator object, implement the transitionDuration: method to specify the duration of your transition and implement the animateTransition: method to create the animations themselves. Information about the objects involved in the transition is passed to your animateTransition: method in the form of a context object. Use the information provided by that object to move the target view controller’s view on or off screen over the specified duration.

Create your animator object from a transitioning delegate—an object that conforms to the UIViewControllerTransitioningDelegate protocol. When presenting a view controller, set the presentation style to UIModalPresentationCustom and assign your transitioning delegate to the view controller’s transitioningDelegate property. The view controller retrieves your animator object from the transitioning delegate and uses it to perform the animations. You can provide separate animator objects for presenting and dismissing the view controller.

To add user interaction to a view controller transition, you must use an animator object together with an interactive animator object—a custom object that adopts the UIViewControllerInteractiveTransitioning protocol. For more on defining interactive transitions, see UIViewControllerInteractiveTransitioning.

Topics

Performing a Transition

- animateTransition:

Tells your animator object to perform the transition animations.

Required.

- animationEnded:

Tells your animator object that the transition animations have finished.

Reporting Transition Duration

- transitionDuration:

Asks your animator object for the duration (in seconds) of the transition animation.

Required.

Returning an Interruptible Animator

- interruptibleAnimatorForTransition:

Returns the interruptible animator to use during the transition.

See Also

Non-Interactive Transitions

UIViewControllerContextTransitioning

A set of methods that provide contextual information for transition animations between view controllers.

Beta Software

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