A set of methods for implementing the animations for a custom view controller transition.
- iOS 7.0+
- tvOS 9.0+
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
transition method to specify the duration of your transition and implement the
animate method to create the animations themselves. Information about the objects involved in the transition is passed to your
animate 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
UIView protocol. When presenting a view controller, set the presentation style to
UIModal and assign your transitioning delegate to the view controller’s
transitioning 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
UIView protocol. For more on defining interactive transitions, see