public interface UIViewControllerContextTransitioning
The system queries the view controller's transitioningDelegate or the navigation controller's delegate to determine if an animator or interaction controller should be used in a transition. The transitioningDelegate is a new property on UIViewController and conforms to the UIViewControllerTransitioningDelegate protocol defined below. The navigation controller likewise has been augmented with a couple of new delegate methods.
The UIViewControllerContextTransitioning protocol can be adopted by custom container controllers. It is purposely general to cover more complex transitions than the system currently supports. For now, navigation push/pops and UIViewController present/dismiss transitions can be customized. Information about the transition is obtained by using the viewControllerForKey:, initialFrameForViewController:, and finalFrameForViewController: methods. The system provides two keys for identifying the from view controller and the to view controller for navigation push/pop and view controller present/dismiss transitions.
All custom animations must invoke the context's completeTransition: method when the transition completes. Furthermore the animation should take place within the containerView specified by the context. For interactive transitions the context's updateInteractiveTransition:, finishInteractiveTransition or cancelInteractiveTransition should be called as the interactive animation proceeds. The UIPercentDrivenInteractiveTransition class provides an implementation of the UIViewControllerInteractiveTransitioning protocol that can be used to interactively drive any UIView property animations that are created by an animator.
| Modifier and Type | Method and Description |
|---|---|
void |
cancelInteractiveTransition() |
void |
completeTransition(boolean didComplete)
This must be called whenever a transition completes (or is cancelled.)
Typically this is called by the object conforming to the
UIViewControllerAnimatedTransitioning protocol that was vended by the transitioning
delegate.
|
UIView |
containerView()
The view in which the animated transition should take place.
|
CGRect |
finalFrameForViewController(UIViewController vc) |
void |
finishInteractiveTransition() |
CGRect |
initialFrameForViewController(UIViewController vc)
The frame's are set to CGRectZero when they are not known or
otherwise undefined.
|
boolean |
isAnimated()
Most of the time this is YES.
|
boolean |
isInteractive()
This indicates whether the transition is currently interactive.
|
void |
pauseInteractiveTransition()
This should be called if the transition animation is interruptible and it
is being paused.
|
long |
presentationStyle() |
CGAffineTransform |
targetTransform() |
boolean |
transitionWasCancelled() |
void |
updateInteractiveTransition(double percentComplete)
An interaction controller that conforms to the
UIViewControllerInteractiveTransitioning protocol (which is vended by a
container view controller's delegate or, in the case of a presentation, the
transitioningDelegate) should call these methods as the interactive
transition is scrubbed and then either cancelled or completed.
|
UIViewController |
viewControllerForKey(java.lang.String key)
Currently only two keys are defined by the
system - UITransitionContextToViewControllerKey, and
UITransitionContextFromViewControllerKey.
|
UIView |
viewForKey(java.lang.String key)
Currently only two keys are defined by the system -
UITransitionContextFromViewKey, and UITransitionContextToViewKey
viewForKey: may return nil which would indicate that the animator should not
manipulate the associated view controller's view.
|
void cancelInteractiveTransition()
void completeTransition(boolean didComplete)
UIView containerView()
CGRect finalFrameForViewController(UIViewController vc)
void finishInteractiveTransition()
CGRect initialFrameForViewController(UIViewController vc)
boolean isAnimated()
boolean isInteractive()
void pauseInteractiveTransition()
long presentationStyle()
CGAffineTransform targetTransform()
boolean transitionWasCancelled()
void updateInteractiveTransition(double percentComplete)
UIViewController viewControllerForKey(java.lang.String key)
UIView viewForKey(java.lang.String key)