UIViewControllerTransitioningDelegate Protocol Reference

Conforms to
Framework
/System/Library/Frameworks/UIKit.framework
Availability
Available in iOS 7.0 and later.
Declared in
UIViewControllerTransitioning.h

Overview

To support custom or interactive transitions for a view controller, configure a custom class to adopt the UIViewControllerTransitioningDelegate protocol.

This protocol defines the methods you can implement to provide animator objects for custom transitions. You can provide distinct custom animators for three phases of view transition: presenting, dismissing, and interacting.

To make use of this protocol, assign your delegate object to the transitioningDelegate property of a view controller object. This property is available starting in iOS 7.0. When you call the presentViewController:animated:completion: method of the view controller and specify a custom transition type, the view controller uses your delegate to retrieve any available animators.

Tasks

Getting the Animator Objects

Getting the Interactive Transition Object

Instance Methods

animationControllerForDismissedController:

Called when a transition requires the animator object to use when dismissing a view controller.

- (id<UIViewControllerAnimatedTransitioning>)animationControllerForDismissedController:(UIViewController *)dismissed
Parameters
dismissed

The view controller object that is about to be dismissed.

Return Value

The animator object to use when dismissing the view controller or nil if you do not want to dismiss the view controller using a custom transition. The object you return should be capable of performing a fixed-length animation that is not interactive.

Discussion

Your implementation of this method should create and return an appropriate animator object. You can use the provided view controllers to initialize your animator object or perform any tasks necessary to prep the transition animations. You may return nil from this method if you do not want to implement a custom transition animation when dismissing view controllers.

For information on implementing a noninteractive animator object, see UIViewControllerAnimatedTransitioning Protocol Reference.

Availability
  • Available in iOS 7.0 and later.
Declared In
UIViewControllerTransitioning.h

animationControllerForPresentedController:presentingController:sourceController:

Called when a transition requires the animator object to use when presenting a view controller.

- (id<UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented presentingController:(UIViewController *)presenting sourceController:(UIViewController *)source
Parameters
presented

The view controller object that is about to be presented onscreen.

presenting

The view controller object that represents the current context for presentation. This could be the root view controller of the window, a parent view controller that is marked as defining the current context, or the last view controller that was presented. This view controller may or may not be the same as the one in the source parameter.

source

The view controller whose presentViewController:animated:completion: method was called.

Return Value

The animator object to use when presenting the view controller or nil if you do not want to present the view controller using a custom transition. The object you return should be capable of performing a fixed-length animation that is not interactive.

Discussion

Your implementation of this method should create and return an appropriate animator object. You can use the provided view controllers to initialize your animator object or perform any tasks necessary to prep the transition animations. You may return nil from this method if you do not want to implement a custom transition animation for the specified set of view controllers.

For information on implementing a noninteractive animator object, see UIViewControllerAnimatedTransitioning Protocol Reference.

Availability
  • Available in iOS 7.0 and later.
Declared In
UIViewControllerTransitioning.h

interactionControllerForDismissal:

Called when a transition requires the animator object that can manage an interactive transition when dismissing a view controller.

- (id<UIViewControllerInteractiveTransitioning>)interactionControllerForDismissal:(id<UIViewControllerAnimatedTransitioning>)animator
Parameters
animator

The standard animator object being used to manage the transition.

Return Value

The animator object that implements the code needed specifically to manage interactive transitions or nil if you do not want to support interactive transitions.

Discussion

If you implement this method, the view controller calls it to retrieve your interactive animator object. The implementation of your animator object should configure the event-handling code and animations required to perform the transition. You can design your interactive animator object to supplement or replace the animator object returned by the animationControllerForDismissedController: method; in either case, you must still implement that method to provide a standard animator object.

For more information on implementing an interactive animator object, see UIViewControllerInteractiveTransitioning Protocol Reference.

Availability
  • Available in iOS 7.0 and later.
Declared In
UIViewControllerTransitioning.h

interactionControllerForPresentation:

Called when a transition requires the animator object that can manage an interactive transition when presenting a view controller.

- (id<UIViewControllerInteractiveTransitioning>)interactionControllerForPresentation:(id<UIViewControllerAnimatedTransitioning>)animator
Parameters
animator

The standard animator object being used to manage the transition.

Return Value

The animator object that implements the code needed specifically to manage interactive transitions or nil if you do not want to support interactive transitions.

Discussion

If you implement this method, the view controller calls it to retrieve your interactive animator object. The implementation of your animator object should configure the event-handling code and animations required to perform the transition. You can design your interactive animator object to supplement or replace the animator object returned by the animationControllerForPresentedController:presentingController:sourceController: method; in either case, you must still implement that method to provide a standard animator object.

For more information on implementing an interactive animator object, see UIViewControllerInteractiveTransitioning Protocol Reference.

Availability
  • Available in iOS 7.0 and later.
Declared In
UIViewControllerTransitioning.h