custom transitions using view controllers · custom view controller transitions roadmap •which...

231
These are confidential sessions—please refrain from streaming, blogging, or taking pictures New capabilities, APIs and enhancements Session 218 Custom Transitions Using View Controllers Bruce D. Nilo View Controller Mechanic

Upload: others

Post on 06-Oct-2020

24 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

These are confidential sessions—please refrain from streaming, blogging, or taking pictures

New capabilities, APIs and enhancements

Session 218

Custom Transitions Using View Controllers

Bruce D. NiloView Controller Mechanic

Page 2: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Roadmap

Page 3: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Roadmap

•New animation tools• Custom view controller transitions• Interactive view controller transitions• Canceling and coordinating transitions

Page 4: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

New animation toolsRoadmap

Page 5: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

New animation toolsRoadmap

•Quick review of the block based UIView animation API

Page 6: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

New animation toolsRoadmap

•Quick review of the block based UIView animation API• Spring animations

Page 7: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

New animation toolsRoadmap

•Quick review of the block based UIView animation API• Spring animations• Key-frame animations

Page 8: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

New animation toolsRoadmap

•Quick review of the block based UIView animation API• Spring animations• Key-frame animations•UIKit Dynamics

Page 9: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Custom view controller transitionsRoadmap

Page 10: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Custom view controller transitionsRoadmap

•Which transitions can be customized?■ Presentations and dismissals■ UITabBarController■ UINavigationController■ UICollectionViewController layout-to-layout transitions

Page 11: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Custom view controller transitionsRoadmap

•Which transitions can be customized?■ Presentations and dismissals■ UITabBarController■ UINavigationController■ UICollectionViewController layout-to-layout transitions

•What is a transition?■ Anatomy and generalizations

Page 12: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Custom view controller transitionsRoadmap

•Which transitions can be customized?■ Presentations and dismissals■ UITabBarController■ UINavigationController■ UICollectionViewController layout-to-layout transitions

•What is a transition?■ Anatomy and generalizations

•API discussion with some examples

Page 13: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Interactive view controller transitionsRoadmap

Page 14: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Interactive view controller transitionsRoadmap

•Adding interactivity to custom transitions

Page 15: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Interactive view controller transitionsRoadmap

•Adding interactivity to custom transitions• Special support for UICollectionViews

■ UICollectionViewTransitionLayout

Page 16: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Interactive view controller transitionsRoadmap

•Adding interactivity to custom transitions• Special support for UICollectionViews

■ UICollectionViewTransitionLayout

• Canceling transitions

Page 17: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Interactive view controller transitionsRoadmap

•Adding interactivity to custom transitions• Special support for UICollectionViews

■ UICollectionViewTransitionLayout

• Canceling transitions•UITransitionCoordinator

■ Animating alongside transitions■ Specifying a completion handler

■ This can be used for all UINavigationController transitions!

Page 18: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Create compelling, custom, view controller transitionsNew UIView Animation APIs

Page 19: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Quick review: Existing UIView block based APINew UIView Animation APIs

Page 20: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Quick review: Existing UIView block based APINew UIView Animation APIs

+ (void) beginAnimations:context:+ (void) commitAnimations

Page 21: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Quick review: Existing UIView block based APINew UIView Animation APIs

+ (void) beginAnimations:context:+ (void) commitAnimations

+ (void)animateWithDuration:(NSTimeInterval)duration delay:(NSTimeInterval)delay options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion;

Page 22: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

} completion: nil];

New UIView Animation APIsQuick review: Relationship to core animation

[UIView animationWithDuration:delay:options:animations:^{

Relationship to core animation

[UIView animationWithDuration:...animations:^{

Page 23: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

} completion: nil];

New UIView Animation APIsQuick review: Relationship to core animation

[UIView animationWithDuration:delay:options:animations:^{

Relationship to core animation

[UIView animationWithDuration:...animations:^{

Page 24: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

} completion: nil];

New UIView Animation APIsQuick review: Relationship to core animation

UIViewUIView

UIViewUIView

[UIView animationWithDuration:delay:options:animations:^{

Relationship to core animation

[UIView animationWithDuration:...animations:^{

Page 25: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

} completion: nil];

UIViewUIView

UIViewCALayer

New UIView Animation APIsQuick review: Relationship to core animation

UIViewUIView

UIViewUIView

[UIView animationWithDuration:delay:options:animations:^{

Upd

ate

prop

erti

esRelationship to core animation

[UIView animationWithDuration:...animations:^{

Page 26: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

[UIView animationWithDuration:delay:options:animations:^{

Quick review: Relationship to core animation

UIViewUIView

UIView

New UIView Animation APIsRelationship to core animation

UIViewUIView

UIViewUIView

[UIView animationWithDuration:...animations:^{

} completion: nil];

Upd

ate

prop

erti

es

CALayer

Page 27: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

[UIView animationWithDuration:delay:options:animations:^{

Quick review: Relationship to core animation

UIViewUIView

UIView

New UIView Animation APIsRelationship to core animation

UIViewUIView

UIViewUIView

[UIView animationWithDuration:...animations:^{

} completion: nil];

Upd

ate

prop

erti

es

CALayer

CAAnimationsadded to layers

Page 28: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

UIView block based APINew UIView Animation APIs

•Disabling and enabling animations+ (void)setAnimationsEnabled:(BOOL)

Page 29: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

UIView block based APINew UIView Animation APIs

+ (void)performWithoutAnimation:(void ^(void))actions;

Page 30: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

UIView block based APINew UIView Animation APIs

+ (void)performWithoutAnimation:(void ^(void))actions;

Page 31: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Spring animationsNew UIView Animation APIs

Page 32: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Spring animationsNew UIView Animation APIs

• Two new parameters■ DampingRatio

■ 1.0 >= r > 0.0■ Initial Spring Velocity

• Composes nicely with other UIView animation methods

Page 33: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Spring animationsNew UIView Animation APIs

+ (void)animateWithDuration:(NSTimeInterval)duration delay:(NSTimeInterval)delay usingSpringWithDamping:(CGFloat)dampingRatio initialSpringVelocity:(CGFloat)velocity options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion;

Page 34: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Spring animationsNew UIView Animation APIs

+ (void)animateWithDuration:(NSTimeInterval)duration delay:(NSTimeInterval)delay usingSpringWithDamping:(CGFloat)dampingRatio initialSpringVelocity:(CGFloat)velocity options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion;

Page 35: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Key-frame animationsNew UIView Animation APIs

Page 36: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Key-frame animationsNew UIView Animation APIs

• animateKeyframesWithDuration…■ is to CAKeyframeAnimation

Page 37: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Key-frame animationsNew UIView Animation APIs

• animateKeyframesWithDuration…■ is to CAKeyframeAnimation

• as animateWithDuration…■ is to CABasicAnimation

Page 38: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Key-frame animationsNew UIView Animation APIs

• animateKeyframesWithDuration…■ is to CAKeyframeAnimation

• as animateWithDuration…■ is to CABasicAnimation

• Specify keyframes within the animation block■ Options augmented to include calculation mode

Page 39: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Key-frame animationsNew UIView Animation APIs

• animateKeyframesWithDuration…■ is to CAKeyframeAnimation

• as animateWithDuration…■ is to CABasicAnimation

• Specify keyframes within the animation block■ Options augmented to include calculation mode

• Composes nicely with other UIView animation methods

Page 40: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Key-frame animationsNew View Based Animation APIs

+ (void)animateKeyframesWithDuration:(NSTimeInterval)duration delay:(NSTimeInterval)delay options:(UIViewKeyframeAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion;

+ (void)addKeyframeWithRelativeStartTime:(double)frameStartTime relativeDuration:(double)frameDuration animations:(void (^)(void))animations

Page 41: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Key-frame animationsNew View Based Animation APIs

+ (void)animateKeyframesWithDuration:(NSTimeInterval)duration delay:(NSTimeInterval)delay options:(UIViewKeyframeAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion;

+ (void)addKeyframeWithRelativeStartTime:(double)frameStartTime relativeDuration:(double)frameDuration animations:(void (^)(void))animations

Page 42: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Key-frame animationsNew View Based Animation APIs

+ (void)animateKeyframesWithDuration:(NSTimeInterval)duration delay:(NSTimeInterval)delay options:(UIViewKeyframeAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion;

+ (void)addKeyframeWithRelativeStartTime:(double)frameStartTime relativeDuration:(double)frameDuration animations:(void (^)(void))animations

Page 43: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Key-frame animationsNew View Based Animation APIs

[UIView animateKeyframesWithDuration: .35delay: 0.0options:0animations:^{

[UIView addKeyframe… animations: ^{…}];[UIView addKeyframe… animations:^{…}];[UIView addKeyframe… animations:^{[someView setPosition:…];// etc.}];}

completion:^(BOOL finished) {…}];

Page 44: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Key-frame animationsNew View Based Animation APIs

[UIView animateKeyframesWithDuration: .35delay: 0.0options:0animations:^{

[UIView addKeyframe… animations: ^{…}];[UIView addKeyframe… animations:^{…}];[UIView addKeyframe… animations:^{[someView setPosition:…];// etc.}];}

completion:^(BOOL finished) {…}];

Page 45: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Key-frame animationsNew View Based Animation APIs

[UIView animateKeyframesWithDuration: .35delay: 0.0options:0animations:^{

[UIView addKeyframe… animations: ^{…}];[UIView addKeyframe… animations:^{…}];[UIView addKeyframe… animations:^{[someView setPosition:…];// etc.}];}

completion:^(BOOL finished) {…}];

Page 46: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

UIView snapshotsImproved and Simplified Snapshot API

Page 47: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

UIView snapshotsImproved and Simplified Snapshot API

• Snapshot API- (UIView *)[UIView snapshotView]- (UIView *)[UIView resizableSnapshotViewFromRect:(CGRect)rect withCapInsets:(UIEdgeInsets)capInsets

Page 48: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

UIView snapshotsImproved and Simplified Snapshot API

• Snapshot API- (UIView *)[UIView snapshotView]- (UIView *)[UIView resizableSnapshotViewFromRect:(CGRect)rect withCapInsets:(UIEdgeInsets)capInsets

• Creating snapshots from snapshots is supported

Page 49: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

UIKit DynamicsNew View Based Animation APIs

Page 50: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

UIKit DynamicsNew View Based Animation APIs

•Distinct from UIView animation APIs

Page 51: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

UIKit DynamicsNew View Based Animation APIs

•Distinct from UIView animation APIs■ Compatible with the new transitioning APIs■ More in this afternoon’s talk

Page 52: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

It’s easy to use

Customizing Your View Controller Transitions

Page 53: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Which transitions can be customized?Custom View Controller Transitions

Page 54: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Which transitions can be customized?Custom View Controller Transitions

• Presentations and dismissals■ Supported presentation styles

■ UIModalPresentationFullScreen■ UIModalPresentationCustom

Page 55: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Which transitions can be customized?Custom View Controller Transitions

• Presentations and dismissals■ Supported presentation styles

■ UIModalPresentationFullScreen■ UIModalPresentationCustom

The from view controller is not removed from the window hierarchy

Page 56: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

UIViewController *vc = …;id <UIViewControllerTransitioningDelegate> transitioningDelegate;vc.modalPresentationStyle = UIModalPresentationCustom;[vc setTransitioningDelegate: transitioningDelegate];[self presentViewController:vc animated: YES completion: nil];

Which transitions can be customized?Custom View Controller Transitions

• Presentations and dismissals■ Supported presentation styles

■ UIModalPresentationFullScreen■ UIModalPresentationCustom

The from view controller is not removed from the window hierarchy

Page 57: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

UIViewController *vc = …;id <UIViewControllerTransitioningDelegate> transitioningDelegate;vc.modalPresentationStyle = UIModalPresentationCustom;[vc setTransitioningDelegate: transitioningDelegate];[self presentViewController:vc animated: YES completion: nil];

Which transitions can be customized?Custom View Controller Transitions

• Presentations and dismissals■ Supported presentation styles

■ UIModalPresentationFullScreen■ UIModalPresentationCustom

The from view controller is not removed from the window hierarchy

Page 58: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Which transitions can be customized?Custom View Controller Transitions

Page 59: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Which transitions can be customized?Custom View Controller Transitions

•UITabBarController setSelectedViewController:(UIViewController *)vc;setSelectedIndex:(NSUInteger)idx;

Page 60: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Which transitions can be customized?Custom View Controller Transitions

•UITabBarController setSelectedViewController:(UIViewController *)vc;setSelectedIndex:(NSUInteger)idx;

NSUInteger secondTab = 1;self.delegate = tabBarControllerDelegate;[self setSelectedIndex:secondTab];

Page 61: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Which transitions can be customized?Custom View Controller Transitions

Page 62: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Which transitions can be customized?Custom View Controller Transitions

•UINavigationController pushViewController:animated:popViewControllerAnimated:setViewControllers:animated:

Page 63: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Which transitions can be customized?Custom View Controller Transitions

•UINavigationController pushViewController:animated:popViewControllerAnimated:setViewControllers:animated:

self.delegate = navigationControllerDelegate;[self pushViewController:vc animated:YES];

Page 64: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

UINavigationController meets UICollectionViewControllerCustom View Controller Transitions

Page 65: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

UINavigationController meets UICollectionViewControllerCustom View Controller Transitions

• Layout-to-layout navigation transitions

Page 66: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

UINavigationController meets UICollectionViewControllerCustom View Controller Transitions

• Layout-to-layout navigation transitions

UICollectionViewLayout *layout1,*layout2,*layout3;UICollectionViewController *cvc1, *cvc2, *cvc3;cvc1 = [cvc1 initWithCollectionViewLayout:layout1];

[nav pushViewController:cvc1 animated:YES]cvc2.useLayoutToLayoutNavigationTransitions = YES;cvc3.useLayoutToLayoutNavigationTransitions = YES;[nav pushViewController:cvc2 animated:YES];[nav pushViewController:cvc3 animated:YES];[nav popViewControllerAnimated:YES];

Page 67: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

DemoSome examples of custom transitions

Page 68: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Concepts and APIs

Customizing Your View Controller Transitions

Page 69: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

The anatomy of a transitionCustom View Controller Transitions

Child A

Parent VC

Child A

Parent View

View Child A

Parent VC

Parent View

Child A View

Child B

Child B

WindowWindow

Start State End State Legend

VC-View

Containment

Superview

Relationships:

Objects:View Controller

View

Page 70: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

The anatomy of a transitionCustom View Controller Transitions

Parent VC

Parent View

Child A View

Child BChild B

Window

Intermediate State

Child A

Page 71: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Container View

Child A

The anatomy of a transitionCustom View Controller Transitions

Intermediate State

Child A

Parent VC

View

Child B

WindowChild B

Page 72: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Container View

Child A

The anatomy of a transitionCustom View Controller Transitions

Intermediate State

Child A

Parent VC

View

Child B

WindowChild B

Child A

Page 73: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Container View

Child A

The anatomy of a transitionCustom View Controller Transitions

Intermediate State

Child A

Parent VC

View

Child B

WindowChild B

Page 74: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Container View

Child A

The anatomy of a transitionCustom View Controller Transitions

Intermediate State

Child A

Parent VC

View

Child B

Window

Child B Child B

Page 75: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

The anatomy of a transitionCustom View Controller Transitions

Child A

Parent VC

Parent View

Child A View

Child B

Child B

Window

End State

Page 76: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

The anatomy of a transitionCustom View Controller Transitions

Page 77: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

The anatomy of a transitionCustom View Controller Transitions

• Start state ■ Consistent view controller hierarchy and view hierarchy

Page 78: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

The anatomy of a transitionCustom View Controller Transitions

• Start state ■ Consistent view controller hierarchy and view hierarchy

•User or programmatic transition commences

Page 79: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

The anatomy of a transitionCustom View Controller Transitions

• Start state ■ Consistent view controller hierarchy and view hierarchy

•User or programmatic transition commences• Internal structures are updated, callbacks made, etc.

Page 80: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

The anatomy of a transitionCustom View Controller Transitions

• Start state ■ Consistent view controller hierarchy and view hierarchy

•User or programmatic transition commences• Internal structures are updated, callbacks made, etc.• Container view, and start and final view positions are computed

Page 81: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

The anatomy of a transitionCustom View Controller Transitions

• Start state ■ Consistent view controller hierarchy and view hierarchy

•User or programmatic transition commences• Internal structures are updated, callbacks made, etc.• Container view, and start and final view positions are computed•Optional animation to end state view hierarchy is run

Page 82: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

The anatomy of a transitionCustom View Controller Transitions

• Start state ■ Consistent view controller hierarchy and view hierarchy

•User or programmatic transition commences• Internal structures are updated, callbacks made, etc.• Container view, and start and final view positions are computed•Optional animation to end state view hierarchy is run•Animation completes

■ Internal structures are updated, callbacks made, etc.

Page 83: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

The anatomy of a transitionCustom View Controller Transitions

• Start state ■ Consistent view controller hierarchy and view hierarchy

•User or programmatic transition commences• Internal structures are updated, callbacks made, etc.• Container view, and start and final view positions are computed•Optional animation to end state view hierarchy is run•Animation completes

■ Internal structures are updated, callbacks made, etc.

• End State■ Consistent view controller hierarchy and view hierarchy

Page 84: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

The anatomy of a transitionCustom View Controller Transitions

• Start state ■ Consistent view controller hierarchy and view hierarchy

•User or programmatic transition commences• Internal structures are updated, callbacks made, etc.• Container view, and start and final view positions are computed•Optional animation to end state view hierarchy is run•Animation completes

■ Internal structures are updated, callbacks made, etc.

• End State■ Consistent view controller hierarchy and view hierarchy

Page 85: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

<UIViewControllerContextTransitioning>Custom View Controller Transitions

@protocol UIViewControllerContextTransitioning <NSObject>

// The view in which the animated transition should take place.- (UIView *)containerView;

// Two keys for the method below are currently defined by the system // UITransitionContextToViewControllerKey, and UITransitionContextFromViewControllerKey.

- (UIViewController *) viewControllerForKey:(NSString *)key;- (CGRect) initialFrameForViewController:(UIViewController *)vc;- (CGRect) finalFrameForViewController:(UIViewController *)vc;

// This MUST be called whenever a transition completes (or is cancelled.)- (void)completeTransition:(BOOL)didComplete;...@end

Page 86: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

<UIViewControllerContextTransitioning>Custom View Controller Transitions

@protocol UIViewControllerContextTransitioning <NSObject>

// The view in which the animated transition should take place.- (UIView *)containerView;

// Two keys for the method below are currently defined by the system // UITransitionContextToViewControllerKey, and UITransitionContextFromViewControllerKey.

- (UIViewController *) viewControllerForKey:(NSString *)key;- (CGRect) initialFrameForViewController:(UIViewController *)vc;- (CGRect) finalFrameForViewController:(UIViewController *)vc;

// This MUST be called whenever a transition completes (or is cancelled.)- (void)completeTransition:(BOOL)didComplete;...@end

Page 87: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

<UIViewControllerContextTransitioning>Custom View Controller Transitions

@protocol UIViewControllerContextTransitioning <NSObject>

// The view in which the animated transition should take place.- (UIView *)containerView;

// Two keys for the method below are currently defined by the system // UITransitionContextToViewControllerKey, and UITransitionContextFromViewControllerKey.

- (UIViewController *) viewControllerForKey:(NSString *)key;- (CGRect) initialFrameForViewController:(UIViewController *)vc;- (CGRect) finalFrameForViewController:(UIViewController *)vc;

// This MUST be called whenever a transition completes (or is cancelled.)- (void)completeTransition:(BOOL)didComplete;...@end

Page 88: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

<UIViewControllerContextTransitioning>Custom View Controller Transitions

@protocol UIViewControllerContextTransitioning <NSObject>

// The view in which the animated transition should take place.- (UIView *)containerView;

// Two keys for the method below are currently defined by the system // UITransitionContextToViewControllerKey, and UITransitionContextFromViewControllerKey.

- (UIViewController *) viewControllerForKey:(NSString *)key;- (CGRect) initialFrameForViewController:(UIViewController *)vc;- (CGRect) finalFrameForViewController:(UIViewController *)vc;

// This MUST be called whenever a transition completes (or is cancelled.)- (void)completeTransition:(BOOL)didComplete;...@end

Page 89: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

<UIViewControllerAnimatedTransitioning>Custom View Controller Transitions

@protocol UIViewControllerAnimatedTransitioning <NSObject>

- (NSTimeInterval)transitionDuration:(id <UIViewControllerContextTransitioning>)ctx;

// This method can only be a nop if the transition is interactive and not a percentDriven interactive transition.- (void)animateTransition:(id <UIViewControllerContextTransitioning>)ctx;

@optional

// This is a convenience and if implemented will be invoked by the system when the transition context's completeTransition: method is invoked.- (void)animationEnded:(BOOL) transitionCompleted;

@end

Page 90: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

<UIViewControllerAnimatedTransitioning>Custom View Controller Transitions

@protocol UIViewControllerAnimatedTransitioning <NSObject>

- (NSTimeInterval)transitionDuration:(id <UIViewControllerContextTransitioning>)ctx;

// This method can only be a nop if the transition is interactive and not a percentDriven interactive transition.- (void)animateTransition:(id <UIViewControllerContextTransitioning>)ctx;

@optional

// This is a convenience and if implemented will be invoked by the system when the transition context's completeTransition: method is invoked.- (void)animationEnded:(BOOL) transitionCompleted;

@end

Page 91: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

<UIViewControllerAnimatedTransitioning>Custom View Controller Transitions

@protocol UIViewControllerAnimatedTransitioning <NSObject>

- (NSTimeInterval)transitionDuration:(id <UIViewControllerContextTransitioning>)ctx;

// This method can only be a nop if the transition is interactive and not a percentDriven interactive transition.- (void)animateTransition:(id <UIViewControllerContextTransitioning>)ctx;

@optional

// This is a convenience and if implemented will be invoked by the system when the transition context's completeTransition: method is invoked.- (void)animationEnded:(BOOL) transitionCompleted;

@end

Page 92: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Child A

Parent VC

View

Child B

Window

The anatomy of a transitionCustom View Controller Transitions

Parent View

Child A

Child B

Page 93: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Child A

Parent VC

View

Child B

Window

The anatomy of a transitionCustom View Controller Transitions

(id <UIViewControllerContexTransitioning>) context;[animationController animateTransition: context];

Parent View

Child A

Child B

Page 94: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Child A

Parent VC

View

Child B

Window

The anatomy of a transitionCustom View Controller Transitions

(id <UIViewControllerContexTransitioning>) context;[animationController animateTransition: context];

Parent View

Child A

Child B Child B

Page 95: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Child A

Parent VC

View

Child B

Window

The anatomy of a transitionCustom View Controller Transitions

(id <UIViewControllerContexTransitioning>) context;[context completeTransition: YES];

Parent View

Child A

Child B Child B

Page 96: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

The anatomy of a transitionCustom View Controller Transitions

Child A

Parent VC

Parent View

Child A View

Child B

Child B

Window

Page 97: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Wiring it all togetherCustom View Controller Transitions

Page 98: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Wiring it all togetherCustom View Controller Transitions

•Animation and interaction controllers are vended by delegates<UIViewControllerTransitioningDelegate><UINavigationControllerDelegate><UITabBarControllerDelegate>

Page 99: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Wiring it all togetherCustom View Controller Transitions

•Animation and interaction controllers are vended by delegates<UIViewControllerTransitioningDelegate><UINavigationControllerDelegate><UITabBarControllerDelegate>

•Animation controllers conform to a protocol<UIViewControllerAnimatedTransitioning>

Page 100: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Wiring it all togetherCustom View Controller Transitions

•Animation and interaction controllers are vended by delegates<UIViewControllerTransitioningDelegate><UINavigationControllerDelegate><UITabBarControllerDelegate>

•Animation controllers conform to a protocol<UIViewControllerAnimatedTransitioning>

• Interaction controllers conform to a protocol<UIViewControllerInteractiveTransitioning>

Page 101: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Wiring it all togetherCustom View Controller Transitions

•Animation and interaction controllers are vended by delegates<UIViewControllerTransitioningDelegate><UINavigationControllerDelegate><UITabBarControllerDelegate>

•Animation controllers conform to a protocol<UIViewControllerAnimatedTransitioning>

• Interaction controllers conform to a protocol<UIViewControllerInteractiveTransitioning>

•A system object passed to the controllers conforms to<UIViewControllerContextTransitioning>

Page 102: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Start of a custom presentationCustom View Controller Transitions

Presented Controller

Presenting Controller

transitionDelegate

Page 103: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Start of a custom presentationCustom View Controller Transitions

Presented Controller

<UIViewControllerTransitioningDelegate>(transitionDelegate)

setTransitioningDelegate:

Presenting Controller

transitionDelegate

Page 104: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Start of a custom presentationCustom View Controller Transitions

Presented Controller

<UIViewControllerTransitioningDelegate>(transitionDelegate)

setTransitioningDelegate:

Presenting Controller

Presented Controller

presentViewController:

transitionDelegate

Page 105: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Start of a custom presentationCustom View Controller Transitions

Presented Controller

<UIViewControllerTransitioningDelegate>(transitionDelegate)

setTransitioningDelegate:

Presenting Controller

Presented Controller

presentViewController:

transitionDelegate

animationControllerForPresentingController:presentedController:sourceController: <UIViewControllerAnimatedTransitioning>

(animationController)

Page 106: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

End of a custom presentationCustom View Controller Transitions

animationController

animationController

context

Page 107: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

End of a custom presentationCustom View Controller Transitions

animationController <UIViewControllerContextTransitioning>(context)

transitionDuration:

animationController

context

Page 108: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

End of a custom presentationCustom View Controller Transitions

animationController <UIViewControllerContextTransitioning>(context)

transitionDuration:

animationController <UIViewControllerContextTransitioning>(context)

animateTransition:

context

Page 109: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

End of a custom presentationCustom View Controller Transitions

animationController <UIViewControllerContextTransitioning>(context)

transitionDuration:

animationController <UIViewControllerContextTransitioning>(context)

animateTransition:

context animationControllercompleteTransition:

Page 110: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Pseudo-code of a custom presentation Custom View Controller Transitions

Page 111: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

id <UIViewControllerTransitioningDelegate> delegate;[presentedController setTransitioningDelegate:delegate];[presentedController setModalPresentationStyle: UIModalPresentationCustom];[self presentViewController:presentedController animated: YES completion:nil];

Pseudo-code of a custom presentation Custom View Controller Transitions

Page 112: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

id <UIViewControllerTransitioningDelegate> delegate;[presentedController setTransitioningDelegate:delegate];[presentedController setModalPresentationStyle: UIModalPresentationCustom];[self presentViewController:presentedController animated: YES completion:nil];

Pseudo-code of a custom presentation Custom View Controller Transitions

id <UIViewControllerAnimatedTransitioning> animationController = [delegate animationControllerForPresentedController: presented presentingController: presenter sourceController: target];

Page 113: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

id <UIViewControllerContextTransitioning>)ctx;NSTimeInterval duration = [animationController transitionDuration:ctx]; [animationController animateTransition:ctx];

Pseudo-code of a custom presentation Custom View Controller Transitions

Page 114: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

id <UIViewControllerContextTransitioning>)ctx;NSTimeInterval duration = [animationController transitionDuration:ctx]; [animationController animateTransition:ctx];

Pseudo-code of a custom presentation Custom View Controller Transitions

Page 115: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

- (void)animateTransition:(id <UIViewControllerContextTransitioning>ctx { UIView *inView = [ctx containerView]; UIView *toView = [[ctx viewControllerForKey:…] view]; UIView *fromView = [[ctx viewControllerForKey: …]; CGSize size = toEndFrame.size; if(self.isPresentation) { … [inView addSubview: toView]; } else { … [inView insertSubview:toView belowSubview: [fromVC view]]; }

[UIView animateWithDuration: self.transitionDuration animations: ^ { if(self.isPresentation) { toView.center = newCenter; toView.bounds = newBounds; } else {

…} completion: ^(BOOL finished) { [ctx completeTransition: YES];}];

}

Pseudo-code of a custom presentation Custom View Controller Transitions

Page 116: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

- (void)animateTransition:(id <UIViewControllerContextTransitioning>ctx { UIView *inView = [ctx containerView]; UIView *toView = [[ctx viewControllerForKey:…] view]; UIView *fromView = [[ctx viewControllerForKey: …]; CGSize size = toEndFrame.size; if(self.isPresentation) { … [inView addSubview: toView]; } else { … [inView insertSubview:toView belowSubview: [fromVC view]]; }

[UIView animateWithDuration: self.transitionDuration animations: ^ { if(self.isPresentation) { toView.center = newCenter; toView.bounds = newBounds; } else {

…} completion: ^(BOOL finished) { [ctx completeTransition: YES];}];

}

Pseudo-code of a custom presentation Custom View Controller Transitions

Page 117: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

- (void)animateTransition:(id <UIViewControllerContextTransitioning>ctx { UIView *inView = [ctx containerView]; UIView *toView = [[ctx viewControllerForKey:…] view]; UIView *fromView = [[ctx viewControllerForKey: …]; CGSize size = toEndFrame.size; if(self.isPresentation) { … [inView addSubview: toView]; } else { … [inView insertSubview:toView belowSubview: [fromVC view]]; }

[UIView animateWithDuration: self.transitionDuration animations: ^ { if(self.isPresentation) { toView.center = newCenter; toView.bounds = newBounds; } else {

…} completion: ^(BOOL finished) { [ctx completeTransition: YES];}];

}

Pseudo-code of a custom presentation Custom View Controller Transitions

Page 118: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

id <UIViewControllerContextTransitioning>)ctx;[ctx completeTransition:YES];

Pseudo-code of a custom presentation Custom View Controller Transitions

Page 119: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

UIViewControllerTransitioningDelegateCustom View Controller Transitions

@protocol UIViewControllerTransitioningDelegate <NSObject>

@optional

- (id <UIViewControllerAnimatedTransitioning>) animationControllerForPresentedController:(UIVC *)presented

presentingController:(UIVC *)presenting sourceController:(UIVC *)source;

- (id <UIViewControllerAnimatedTransitioning>) animationControllerForDismissedController:(UIVC *)dismissed;

- (id <UIViewControllerInteractiveTransitioning>) interactionControllerForPresentation:(id <UIViewControllerAnimatedTransitioning>)a;

- (id <UIViewControllerInteractiveTransitioning>) interactionControllerForDismissal:(id <UIViewControllerAnimatedTransitioning>)a;

@end

Page 120: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

UIViewControllerTransitioningDelegateCustom View Controller Transitions

@protocol UIViewControllerTransitioningDelegate <NSObject>

@optional

- (id <UIViewControllerAnimatedTransitioning>) animationControllerForPresentedController:(UIVC *)presented

presentingController:(UIVC *)presenting sourceController:(UIVC *)source;

- (id <UIViewControllerAnimatedTransitioning>) animationControllerForDismissedController:(UIVC *)dismissed;

- (id <UIViewControllerInteractiveTransitioning>) interactionControllerForPresentation:(id <UIViewControllerAnimatedTransitioning>)a;

- (id <UIViewControllerInteractiveTransitioning>) interactionControllerForDismissal:(id <UIViewControllerAnimatedTransitioning>)a;

@end

Page 121: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

UIViewControllerTransitioningDelegateCustom View Controller Transitions

@protocol UIViewControllerTransitioningDelegate <NSObject>

@optional

- (id <UIViewControllerAnimatedTransitioning>) animationControllerForPresentedController:(UIVC *)presented

presentingController:(UIVC *)presenting sourceController:(UIVC *)source;

- (id <UIViewControllerAnimatedTransitioning>) animationControllerForDismissedController:(UIVC *)dismissed;

- (id <UIViewControllerInteractiveTransitioning>) interactionControllerForPresentation:(id <UIViewControllerAnimatedTransitioning>)a;

- (id <UIViewControllerInteractiveTransitioning>) interactionControllerForDismissal:(id <UIViewControllerAnimatedTransitioning>)a;

@end

Page 122: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

@interface UIViewController(CustomTransitioning)

@property (nonatomic,retain) id <UIViewControllerTransitioningDelegate>transitionDelegate;

@end

UIViewControllerTransitioningDelegateCustom View Controller Transitions

Page 123: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

@interface UIViewController(CustomTransitioning)

@property (nonatomic,retain) id <UIViewControllerTransitioningDelegate>transitionDelegate;

@end

UIViewControllerTransitioningDelegateCustom View Controller Transitions

Page 124: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

UINavigationControllerDelegate ExtensionsCustom View Controller Transitions

- (id <UIViewControllerAnimatedTransitioning>)navigationController: (UINC *)nc animationControllerForOperation: (UINavigationControllerOperation)op fromViewController:(UIViewController *)fromVC toViewController:(UIViewController *)toVC;

- (id <UIViewControllerInteractiveTransitioning>)navigationController: (UINC *)nc interactionControllerForAnimationController: (id <UIViewControllerAnimatedTransitioning>)a;

Page 125: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

UITabBarControllerDelegate ExtensionsCustom View Controller Transitions

- (id <UIViewControllerAnimatedTransitioning>)tabBarController: (UITABC *)tbc animationControllerForTransitionFromViewController:(UIVC *)fromVC toViewController:(UIVC *)toVC;

- (id <UIViewControllerInteractiveTransitioning>)tabBarController: (UITABC *)tbc interactionControllerForAnimationController: (id <UIViewControllerAnimatedTransitioning>)a;

Page 126: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Responsibilities of the animation controllerCustom View Controller Transitions

Page 127: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Responsibilities of the animation controllerCustom View Controller Transitions

• Implementation of animateTransition: and transitionDuration:■ Insertion of “to” view controller’s view into the container view

Page 128: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Responsibilities of the animation controllerCustom View Controller Transitions

• Implementation of animateTransition: and transitionDuration:■ Insertion of “to” view controller’s view into the container view

•When the transition animation completes■ The “to” and “from” view controller’s views need to be in their designated positions

■ The context’s completeTransition: method must be invoked

Page 129: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Introduction

Interactive View Controller Transitions

Page 130: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Running transition animations interactivelyInteractive View Controller Transitions

•UINavigationController■ Interactive pop gesture is pervasive on iOS 7.0

Page 131: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Running transition animations interactivelyInteractive View Controller Transitions

•UINavigationController■ Interactive pop gesture is pervasive on iOS 7.0

•Applications can define their own interactive transitions

Page 132: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Running transition animations interactivelyInteractive View Controller Transitions

•UINavigationController■ Interactive pop gesture is pervasive on iOS 7.0

•Applications can define their own interactive transitions■ Interactive transitions need not be gesture driven

Page 133: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Running transition animations interactivelyInteractive View Controller Transitions

•UINavigationController■ Interactive pop gesture is pervasive on iOS 7.0

•Applications can define their own interactive transitions■ Interactive transitions need not be gesture driven■ Interactive transitions usually run forwards and backwards

■ Often a transition can start and be cancelled

Page 134: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Running transition animations interactivelyInteractive View Controller Transitions

•UINavigationController■ Interactive pop gesture is pervasive on iOS 7.0

•Applications can define their own interactive transitions■ Interactive transitions need not be gesture driven■ Interactive transitions usually run forwards and backwards

■ Often a transition can start and be cancelled

•UIKit provides a concrete interaction controller class■ UIPercentDrivenInteractiveTransition

Page 135: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

<UIViewControllerInteractiveTransitioning>Interactive View Controller Transitions

@protocol UIViewControllerInteractiveTransitioning <NSObject>

- (void)startInteractiveTransition:(id <UIViewControllerContextTransitioning>)ctx;

@optional

- (CGFloat)completionSpeed;- (UIViewAnimationCurve)completionCurve;

@end

Page 136: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

<UIViewControllerInteractiveTransitioning>Interactive View Controller Transitions

@protocol UIViewControllerInteractiveTransitioning <NSObject>

- (void)startInteractiveTransition:(id <UIViewControllerContextTransitioning>)ctx;

@optional

- (CGFloat)completionSpeed;- (UIViewAnimationCurve)completionCurve;

@end

Page 137: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Start of an interactive presentationInteractive View Controller Transitions

Presented Controller

Presenting Controller

transitionDelegate

Page 138: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Start of an interactive presentationInteractive View Controller Transitions

Presented Controller

<UIViewControllerTransitioningDelegate>(transitionDelegate)

setTransitioningDelegate:

Presenting Controller

transitionDelegate

Page 139: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Start of an interactive presentationInteractive View Controller Transitions

Presented Controller

<UIViewControllerTransitioningDelegate>(transitionDelegate)

setTransitioningDelegate:

Presenting Controller

Presented Controller

presentViewController:

transitionDelegate

Page 140: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Start of an interactive presentationInteractive View Controller Transitions

Presented Controller

<UIViewControllerTransitioningDelegate>(transitionDelegate)

setTransitioningDelegate:

Presenting Controller

Presented Controller

presentViewController:

transitionDelegate

animationControllerForPresentingController:presentedController:sourceController:

<UIViewControllerAnimatedTransitioning>(animationController)

<UIViewControllerInteractiveTransitioning>(interactionController)

interactionControllerForPresentation:

Page 141: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Interactive Event Handler

UIViewControllerTransitioningInteractive transitioning states

Start Interactive Transition

No Transition

Update InteractiveTransition

Transition Complete

Animator

Interaction Transition

End

Transition Canceling

No Transition

TransitionFinishing

ContextInteractor

States

Agents

Page 142: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Interactive Event Handler

UIViewControllerTransitioningInteractive transitioning states

Start Interactive Transition

No Transition

Update InteractiveTransition

Transition Complete

Animator

Interaction Transition

End

Transition Canceling

No Transition

TransitionFinishing

ContextInteractor

States

Agents

Page 143: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Interactive Event Handler

UIViewControllerTransitioningInteractive transitioning states

Start Interactive Transition

No Transition

Update InteractiveTransition

Transition Complete

Animator

Interaction Transition

End

Transition Canceling

No Transition

TransitionFinishing

ContextInteractor

States

Agents

Page 144: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Interactive Event Handler

UIViewControllerTransitioningInteractive transitioning states

Start Interactive Transition

No Transition

Update InteractiveTransition

Transition Complete

Animator

Interaction Transition

End

Transition Canceling

No Transition

TransitionFinishing

ContextInteractor

States

Agents

Page 145: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Interactive Event Handler

UIViewControllerTransitioningInteractive transitioning states

Start Interactive Transition

No Transition

Update InteractiveTransition

Transition Complete

Animator

Interaction Transition

End

Transition Canceling

No Transition

TransitionFinishing

ContextInteractor

finishInteractiveTransition

States

Agents

Page 146: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Interactive Event Handler

UIViewControllerTransitioningInteractive transitioning states

Start Interactive Transition

No Transition

Update InteractiveTransition

Transition Complete

Animator

Interaction Transition

End

Transition Canceling

No Transition

TransitionFinishing

ContextInteractor

States

Agents

Page 147: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Interactive Event Handler

UIViewControllerTransitioningInteractive transitioning states

Start Interactive Transition

No Transition

Update InteractiveTransition

Transition Complete

Animator

Interaction Transition

End

Transition Canceling

No Transition

TransitionFinishing

ContextInteractor

States

Agents

Page 148: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Interactive Event Handler

UIViewControllerTransitioningInteractive transitioning states

Start Interactive Transition

No Transition

Update InteractiveTransition

Transition Complete

Animator

Interaction Transition

End

Transition Canceling

No Transition

TransitionFinishing

ContextInteractor

States

Agents

Page 149: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Interactive Event Handler

UIViewControllerTransitioningInteractive transitioning states

Start Interactive Transition

No Transition

Update InteractiveTransition

Transition Complete

Animator

Interaction Transition

End

Transition Canceling

No Transition

TransitionFinishing

ContextInteractor

States

Agents

Page 150: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

The easy way—use UIViewControllerPercentDrivenTransitionInteractive View Controller Transitions

Page 151: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

The easy way—use UIViewControllerPercentDrivenTransitionInteractive View Controller Transitions

• Implement the animation controller■ animatePresentation: must be implemented using the UIView animation block APIs

Page 152: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

The easy way—use UIViewControllerPercentDrivenTransitionInteractive View Controller Transitions

• Implement the animation controller■ animatePresentation: must be implemented using the UIView animation block APIs

• Implement the logic that will drive the interaction■ e.g. The target of a gesture recognizer■ Often this target is a subclass of UIViewControllerPercentDrivenTransition

Page 153: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

The easy way—use UIViewControllerPercentDrivenTransitionInteractive View Controller Transitions

• Implement the animation controller■ animatePresentation: must be implemented using the UIView animation block APIs

• Implement the logic that will drive the interaction■ e.g. The target of a gesture recognizer■ Often this target is a subclass of UIViewControllerPercentDrivenTransition

■ The interaction logic will call■ updateInteractiveTransition:(CGFloat)percent■ completeInteractiveTransition or cancelInteractiveTransition■ (Note that startInteractiveTransition is handled automatically)

Page 154: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

UIPercentDrivenInteractiveTransitionInteractive View Controller Transitions

// The associated animation controller must animate its transition using UIView animation APIs. @interface UIPercentDrivenInteractiveTransition : NSObject <UIViewControllerInteractiveTransitioning>

@property (readonly) CGFloat duration;// The last percentComplete value specified by updateInteractiveTransition:@property (readonly) CGFloat percentComplete;

// completionSpeed defaults to 1.0 which corresponds to a completion duration of// (1 - percentComplete)*duration. It must be greater than 0.0.@property (nonatomic,assign) CGFloat completionSpeed;

// When the interactive part of the transition has completed, this property can// be set to indicate a different animation curve.@property (nonatomic,assign) UIViewAnimationCurve completionCurve;

// Used instead of the corresponding context methods.- (void)updateInteractiveTransition:(CGFloat)percentComplete;- (void)cancelInteractiveTransition;- (void)finishInteractiveTransition;@end

Page 155: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

UIPercentDrivenInteractiveTransitionInteractive View Controller Transitions

// The associated animation controller must animate its transition using UIView animation APIs. @interface UIPercentDrivenInteractiveTransition : NSObject <UIViewControllerInteractiveTransitioning>

@property (readonly) CGFloat duration;// The last percentComplete value specified by updateInteractiveTransition:@property (readonly) CGFloat percentComplete;

// completionSpeed defaults to 1.0 which corresponds to a completion duration of// (1 - percentComplete)*duration. It must be greater than 0.0.@property (nonatomic,assign) CGFloat completionSpeed;

// When the interactive part of the transition has completed, this property can// be set to indicate a different animation curve.@property (nonatomic,assign) UIViewAnimationCurve completionCurve;

// Used instead of the corresponding context methods.- (void)updateInteractiveTransition:(CGFloat)percentComplete;- (void)cancelInteractiveTransition;- (void)finishInteractiveTransition;@end

Page 156: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

The easy way—use UIViewControllerPercentDrivenTransitionInteractive View Controller Transitions

Page 157: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

The easy way—use UIViewControllerPercentDrivenTransitionInteractive View Controller Transitions

Page 158: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

UIPercentDrivenInteractiveTransitionInteractive View Controller Transitions

@interface YYSlideInteractor : UIPercentDrivenInteractiveTransition

- (instancetype)initWithNavigationController:(UINavigationController *)nc;

@property(nonatomic,assign) UINavigationController *parent;@property(nonatomic,assign,getter = isInteractive) BOOL interactive;

@end

Page 159: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

UIPercentDrivenInteractiveTransitionInteractive View Controller Transitions

- (void)handlePinch:(UIPinchGestureRecognizer *)gr { CGFloat scale = [gr scale]; switch ([gr state]) { case UIGestureRecognizerStateBegan: self.interactive = YES; _startScale = scale; [self.parent popViewControllerAnimated:YES]; break; case UIGestureRecognizerStateChanged: { CGFloat percent = (1.0 - scale/_startScale); [self updateInteractiveTransition: (percent <= 0.0) ? 0.0 : percent]; break; } case UIGestureRecognizerStateEnded: case UIGestureRecognizerStateCancelled: if([gr velocity] >= 0.0 || [gr state] == UIGestureRecognizerStateCancelled) [self cancelInteractiveTransition]; else [self finishInteractiveTransition]; self.interactive = NO; break; }}

Page 160: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

UIPercentDrivenInteractiveTransitionInteractive View Controller Transitions

- (void)handlePinch:(UIPinchGestureRecognizer *)gr { CGFloat scale = [gr scale]; switch ([gr state]) { case UIGestureRecognizerStateBegan: self.interactive = YES; _startScale = scale; [self.parent popViewControllerAnimated:YES]; break; case UIGestureRecognizerStateChanged: { CGFloat percent = (1.0 - scale/_startScale); [self updateInteractiveTransition: (percent <= 0.0) ? 0.0 : percent]; break; } case UIGestureRecognizerStateEnded: case UIGestureRecognizerStateCancelled: if([gr velocity] >= 0.0 || [gr state] == UIGestureRecognizerStateCancelled) [self cancelInteractiveTransition]; else [self finishInteractiveTransition]; self.interactive = NO; break; }}

Page 161: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

UIPercentDrivenInteractiveTransitionInteractive View Controller Transitions

- (void)handlePinch:(UIPinchGestureRecognizer *)gr { CGFloat scale = [gr scale]; switch ([gr state]) { case UIGestureRecognizerStateBegan: self.interactive = YES; _startScale = scale; [self.parent popViewControllerAnimated:YES]; break; case UIGestureRecognizerStateChanged: { CGFloat percent = (1.0 - scale/_startScale); [self updateInteractiveTransition: (percent <= 0.0) ? 0.0 : percent]; break; } case UIGestureRecognizerStateEnded: case UIGestureRecognizerStateCancelled: if([gr velocity] >= 0.0 || [gr state] == UIGestureRecognizerStateCancelled) [self cancelInteractiveTransition]; else [self finishInteractiveTransition]; self.interactive = NO; break; }}

Page 162: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

UIPercentDrivenInteractiveTransitionInteractive View Controller Transitions

- (void)handlePinch:(UIPinchGestureRecognizer *)gr { CGFloat scale = [gr scale]; switch ([gr state]) { case UIGestureRecognizerStateBegan: self.interactive = YES; _startScale = scale; [self.parent popViewControllerAnimated:YES]; break; case UIGestureRecognizerStateChanged: { CGFloat percent = (1.0 - scale/_startScale); [self updateInteractiveTransition: (percent <= 0.0) ? 0.0 : percent]; break; } case UIGestureRecognizerStateEnded: case UIGestureRecognizerStateCancelled: if([gr velocity] >= 0.0 || [gr state] == UIGestureRecognizerStateCancelled) [self cancelInteractiveTransition]; else [self finishInteractiveTransition]; self.interactive = NO; break; }}

Page 163: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Interactive Collection View Layout Transitions

Olivier Gutknecht

Page 164: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

UICollectionViewTransitionLayout

Page 165: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

UICollectionViewTransitionLayout

•A new layout interpolating between two layouts

Page 166: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

UICollectionViewTransitionLayout

•A new layout interpolating between two layouts• Interactively or not, with the transitionProgress property

Page 167: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

UICollectionViewTransitionLayout

•A new layout interpolating between two layouts• Interactively or not, with the transitionProgress property• Subclassable

Page 168: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

UICollectionViewTransitionLayout

•A new layout interpolating between two layouts• Interactively or not, with the transitionProgress property• Subclassable• Simple integration with view controller transitions

Page 169: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

UICollectionViewTransitionLayoutCollection Views and Transition Layout

Layout A Layout B

Page 170: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

UICollectionViewTransitionLayoutCollection Views and Transition Layout

Layout A Layout B

0.0

Transition Layout

transitionProgress

Page 171: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

UICollectionViewTransitionLayoutCollection Views and Transition Layout

Layout A Layout B

0.5

Transition Layout

transitionProgress

Page 172: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

UICollectionViewTransitionLayoutCollection Views and Transition Layout

Layout A Layout B

1.0

Transition Layout

transitionProgress

Page 173: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

UICollectionViewTransitionLayoutCollection Views and Transition Layout

Layout A Layout B

1.1

Transition Layout

transitionProgress

Page 174: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

UICollectionViewTransitionLayoutCollection Views and Transition Layout

Layout A Layout B

1.0

Transition Layout

transitionProgress

Page 175: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

UICollectionViewInteractive Transitions

Page 176: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

UICollectionViewInteractive Transitions

•New methods in UICollectionView- (UICollectionViewTransitionLayout *) startInteractiveTransitionToCollectionViewLayout:completion:- (void)finishInteractiveTransition- (void)cancelInteractiveTransition

Page 177: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

UICollectionViewInteractive Transitions

•New methods in UICollectionView- (UICollectionViewTransitionLayout *) startInteractiveTransitionToCollectionViewLayout:completion:- (void)finishInteractiveTransition- (void)cancelInteractiveTransition

•New delegate method- (UICollectionViewTransitionLayout *)collectionView:(UICollectionView*)v transitionLayoutForOldLayout:(UICollectionViewLayout*)o newLayout:(UICollectionViewLayout*)n

Page 178: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

UICollectionViewInteractive Transitions

•New methods in UICollectionView- (UICollectionViewTransitionLayout *) startInteractiveTransitionToCollectionViewLayout:completion:- (void)finishInteractiveTransition- (void)cancelInteractiveTransition

•New delegate method- (UICollectionViewTransitionLayout *)collectionView:(UICollectionView*)v transitionLayoutForOldLayout:(UICollectionViewLayout*)o newLayout:(UICollectionViewLayout*)n

•Does not replace- (void)setCollectionViewLayout:animated:

Page 179: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Subclassing Transition Layout

Page 180: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Subclassing Transition Layout

• Implement your UICollectionViewTransitionLayout subclass■ e.g. update cell positions based on gesture position

Page 181: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Subclassing Transition Layout

• Implement your UICollectionViewTransitionLayout subclass■ e.g. update cell positions based on gesture position

• Create an instance of your own class in your delegate method

Page 182: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Subclassing Transition Layout

• Implement your UICollectionViewTransitionLayout subclass■ e.g. update cell positions based on gesture position

• Create an instance of your own class in your delegate method•On finish or cancel, UIKit animates at correct velocity

■ Track your own parameters updateValue:forAnimatedKey:

■ UIKit will monitor velocity■ UIKit gives you in-sync values on completion and cancel with

valueForAnimatedKey:

Page 183: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Demo

Page 184: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Other enhancementsCollection Views Transitions

Page 185: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Other enhancementsCollection Views Transitions

• Better control of target offsets everywhere targetContentOffsetForProposedContentOffset:

Page 186: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Other enhancementsCollection Views Transitions

• Better control of target offsets everywhere targetContentOffsetForProposedContentOffset:

• Layouts are now notified on transitionsprepareForTransitionToLayout:prepareForTransitionFromLayout:finalizeLayoutTransition

Page 187: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Other enhancementsCollection Views Transitions

• Better control of target offsets everywhere targetContentOffsetForProposedContentOffset:

• Layouts are now notified on transitionsprepareForTransitionToLayout:prepareForTransitionFromLayout:finalizeLayoutTransition

• Better animations■ Initial and final layout attributes are now supported■ A new completion handler

setCollectionViewLayout:animated:completion:

Page 188: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Cancellation and coordinators

Interactive View Controller Transitions

Page 189: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

UIViewControllerTransitioningInteractive transitioning states

Start Interactive Transition

No Transition

Update InteractiveTransition

Transition Complete

Interaction Transition

End

Transition Canceling

No Transition

TransitionFinishing

Page 190: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

UIViewControllerTransitioningInteractive transitioning states

Start Interactive Transition

No Transition

Update InteractiveTransition

Transition Complete

Interaction Transition

End

Transition Canceling

No Transition

TransitionFinishing

Page 191: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

UIViewControllerTransitioningCancellation and appearance callbacks

Transition Complete

Interaction Transition

End

Transition Canceling

TransitionFinishing

Interactive transitioning states View controller appearance states

Appearing Appeared

Disappeared Disappearing

Page 192: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

UIViewControllerTransitioningCancellation and appearance callbacks

Transition Complete

Interaction Transition

End

Transition Canceling

TransitionFinishing

Interactive transitioning states View controller appearance states

Appearing Appeared

Disappeared Disappearing

Page 193: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

UIViewControllerTransitioningCancellation and appearance callbacks

Transition Complete

Interaction Transition

End

Transition Canceling

TransitionFinishing

Interactive transitioning states View controller appearance states

Appearing Appeared

Disappeared Disappearing

Page 194: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Canceling an interactive transitionInteractive View Controller Transitions

Page 195: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Canceling an interactive transitionInteractive View Controller Transitions

•Don’t assume that viewDidAppear follows viewWillAppear

Page 196: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Canceling an interactive transitionInteractive View Controller Transitions

•Don’t assume that viewDidAppear follows viewWillAppear•Make sure to undo any side effects

■ There is new API to help manage this

Page 197: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

@interface UIViewController(TransitionCoordinator)

@property (nonatomic,retain) id <UIViewControllerTransitionCoordinator> transitionCoordinator;

@end

<UIViewControllerTransitionCoordinator>Interactive View Controller Transitions

Page 198: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

@interface UIViewController(TransitionCoordinator)

@property (nonatomic,retain) id <UIViewControllerTransitionCoordinator> transitionCoordinator;

@end

<UIViewControllerTransitionCoordinator>Interactive View Controller Transitions

Page 199: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

<UIViewControllerTransitionCoordinator>Interactive View Controller Transitions

@protocol UIViewControllerTransitionCoordinator <UIViewControllerTransitionCoordinatorContext>

@optional

- (BOOL) notifyWhenInteractionEndsUsingBlock: (void (^ (id<UIViewControllerTransitionCoordinatorContext)handler;

- (BOOL) animatorAlongsideTransition: (void (^) (id <UIViewControllerTransitionCoordinatorContext)a;

completion:(void (^)(id<UIViewControllerTransitionCoordinatorContext)c;

- (BOOL) animatorAlongsideTransitionInView:(UIView *)view animation: (void (^) (id <UIViewControllerTransitionCoordinatorContext)a; completion:(void (^) (id<UIViewControllerTransitionCoordinatorContext)c;

@end

Page 200: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

<UIViewControllerTransitionCoordinator>Interactive View Controller Transitions

@protocol UIViewControllerTransitionCoordinator <UIViewControllerTransitionCoordinatorContext>

@optional

- (BOOL) notifyWhenInteractionEndsUsingBlock: (void (^ (id<UIViewControllerTransitionCoordinatorContext)handler;

- (BOOL) animatorAlongsideTransition: (void (^) (id <UIViewControllerTransitionCoordinatorContext)a;

completion:(void (^)(id<UIViewControllerTransitionCoordinatorContext)c;

- (BOOL) animatorAlongsideTransitionInView:(UIView *)view animation: (void (^) (id <UIViewControllerTransitionCoordinatorContext)a; completion:(void (^) (id<UIViewControllerTransitionCoordinatorContext)c;

@end

Page 201: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

<UIViewControllerTransitionCoordinatorContext>Interactive View Controller Transitions

@protocol UIViewControllerTransitionCoordinatorContext <NSObject>

- (UIView *)containerView;- (UIViewController *) viewControllerForKey:(NSString *)key;- (CGRect) initialFrameForViewController:(UIViewController *)vc;- (CGRect) finalFrameForViewController:(UIViewController *)vc;

- (BOOL) isCancelled;- (BOOL) initiallyInteractive;- (BOOL) isInteractive;

@end

Page 202: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

<UIViewControllerTransitionCoordinatorContext>Interactive View Controller Transitions

@protocol UIViewControllerTransitionCoordinatorContext <NSObject>

- (UIView *)containerView;- (UIViewController *) viewControllerForKey:(NSString *)key;- (CGRect) initialFrameForViewController:(UIViewController *)vc;- (CGRect) finalFrameForViewController:(UIViewController *)vc;

- (BOOL) isCancelled;- (BOOL) initiallyInteractive;- (BOOL) isInteractive;

@end

Page 203: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Canceling an interactive transitionInteractive View Controller Transitions

Page 204: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

•Don’t assume that viewDidAppear follows viewWillAppear:

Canceling an interactive transitionInteractive View Controller Transitions

Page 205: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

- (void) viewWillAppear: {[self doSomeSideEffectsAssumingViewDidAppearIsGoingToBeCalled];

id <UIViewControllerTransitionCoordinator> coordinator;coordinator = [self transitionCoordinator];

if(coordinator && [coordinator initiallyInteractive]) { [transitionCoordinator notifyWhenInteractionEndsUsingBlock: ^(id <UIViewControllerTransitionCoordinatorContext> ctx) { if(ctx.isCancelled) { [self undoSideEffects]; } }];}

}

•Don’t assume that viewDidAppear follows viewWillAppear:

Canceling an interactive transitionInteractive View Controller Transitions

Page 206: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

- (void) viewWillAppear: {[self doSomeSideEffectsAssumingViewDidAppearIsGoingToBeCalled];

id <UIViewControllerTransitionCoordinator> coordinator;coordinator = [self transitionCoordinator];

if(coordinator && [coordinator initiallyInteractive]) { [transitionCoordinator notifyWhenInteractionEndsUsingBlock: ^(id <UIViewControllerTransitionCoordinatorContext> ctx) { if(ctx.isCancelled) { [self undoSideEffects]; } }];}

}

•Don’t assume that viewDidAppear follows viewWillAppear:

Canceling an interactive transitionInteractive View Controller Transitions

Page 207: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

- (void) viewWillAppear: {[self doSomeSideEffectsAssumingViewDidAppearIsGoingToBeCalled];

id <UIViewControllerTransitionCoordinator> coordinator;coordinator = [self transitionCoordinator];

if(coordinator && [coordinator initiallyInteractive]) { [transitionCoordinator notifyWhenInteractionEndsUsingBlock: ^(id <UIViewControllerTransitionCoordinatorContext> ctx) { if(ctx.isCancelled) { [self undoSideEffects]; } }];}

}

•Don’t assume that viewDidAppear follows viewWillAppear:

Canceling an interactive transitionInteractive View Controller Transitions

Page 208: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

- (void) viewWillAppear: {[self doSomeSideEffectsAssumingViewDidAppearIsGoingToBeCalled];

id <UIViewControllerTransitionCoordinator> coordinator;coordinator = [self transitionCoordinator];

if(coordinator && [coordinator initiallyInteractive]) { [transitionCoordinator notifyWhenInteractionEndsUsingBlock: ^(id <UIViewControllerTransitionCoordinatorContext> ctx) { if(ctx.isCancelled) { [self undoSideEffects]; } }];}

}

•Don’t assume that viewDidAppear follows viewWillAppear:

Canceling an interactive transitionInteractive View Controller Transitions

Page 209: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

<UIViewControllerTransitionCoordinator>Interactive View Controller Transitions

Page 210: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

<UIViewControllerTransitionCoordinator>Interactive View Controller Transitions

• The transitionCoordinator does even more■ Allows completion handlers to be registered for transitions

Page 211: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

<UIViewControllerTransitionCoordinator>Interactive View Controller Transitions

• The transitionCoordinator does even more■ Allows completion handlers to be registered for transitions■ Allows other animations to run alongside the transition animation

Page 212: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

<UIViewControllerTransitionCoordinator>Interactive View Controller Transitions

• The transitionCoordinator does even more■ Allows completion handlers to be registered for transitions■ Allows other animations to run alongside the transition animation

• In addition to custom transitions on iOS 7■ UINavigationController transitions have an associated transition coordinator

Page 213: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

<UIViewControllerTransitionCoordinator>Interactive View Controller Transitions

• The transitionCoordinator does even more■ Allows completion handlers to be registered for transitions■ Allows other animations to run alongside the transition animation

• In addition to custom transitions on iOS 7■ UINavigationController transitions have an associated transition coordinator

■ Present and Dismiss transitions have an associated coordinator

Page 214: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

<UIViewControllerTransitionCoordinator>Interactive View Controller Transitions

- (BOOL) animatorAlongsideTransition:(void (^) (id <UIViewControllerTransitionCoordinatorContext)a; completion:(void (^) (id<UIViewControllerTransitionCoordinatorContext)c;- (BOOL) animatorAlongsideTransitionInView:(UIView *)view animation: (void (^) (id <UIViewControllerTransitionCoordinatorContext)a; completion:(void (^) (id<UIViewControllerTransitionCoordinatorContext)c;

Page 215: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

<UIViewControllerTransitionCoordinator>Interactive View Controller Transitions

- (BOOL) animatorAlongsideTransition:(void (^) (id <UIViewControllerTransitionCoordinatorContext)a; completion:(void (^) (id<UIViewControllerTransitionCoordinatorContext)c;- (BOOL) animatorAlongsideTransitionInView:(UIView *)view animation: (void (^) (id <UIViewControllerTransitionCoordinatorContext)a; completion:(void (^) (id<UIViewControllerTransitionCoordinatorContext)c;

Page 216: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Fun with transition coordinatorsInteractive View Controller Transitions

UIViewController *vc;[self pushViewController:vc animated: YES];

id <UIViewControllerTransitionCoordinator>coordinator;coordinator = [viewController transitionCoordinator];

[coordinator animateAlongsideTransition: ^(id <UIViewControllerTransitionCoordinatorContext> c) {

;;; some animation}completion:(id <UIViewControllerTransitionCoordinatorContext> c) { ;;; Code to run after your push transition has finished.}];

Page 217: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Fun with transition coordinatorsInteractive View Controller Transitions

UIViewController *vc;[self pushViewController:vc animated: YES];

id <UIViewControllerTransitionCoordinator>coordinator;coordinator = [viewController transitionCoordinator];

[coordinator animateAlongsideTransition: ^(id <UIViewControllerTransitionCoordinatorContext> c) {

;;; some animation}completion:(id <UIViewControllerTransitionCoordinatorContext> c) { ;;; Code to run after your push transition has finished.}];

Page 218: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Fun with transition coordinatorsInteractive View Controller Transitions

UIViewController *vc;[self pushViewController:vc animated: YES];

id <UIViewControllerTransitionCoordinator>coordinator;coordinator = [viewController transitionCoordinator];

[coordinator animateAlongsideTransition: ^(id <UIViewControllerTransitionCoordinatorContext> c) {

;;; some animation}completion:(id <UIViewControllerTransitionCoordinatorContext> c) { ;;; Code to run after your push transition has finished.}];

Page 219: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Fun with transition coordinatorsInteractive View Controller Transitions

UIViewController *vc;[self pushViewController:vc animated: YES];

id <UIViewControllerTransitionCoordinator>coordinator;coordinator = [viewController transitionCoordinator];

[coordinator animateAlongsideTransition: ^(id <UIViewControllerTransitionCoordinatorContext> c) {

;;; some animation}completion:(id <UIViewControllerTransitionCoordinatorContext> c) { ;;; Code to run after your push transition has finished.}];

Page 220: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

“With great power comes greater responsibility”Concluding Remarks

Page 221: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

“With great power comes greater responsibility”Concluding Remarks

Page 222: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

“With great power comes greater responsibility”Concluding Remarks

Page 223: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

“With great power comes greater responsibility”Concluding Remarks

Page 224: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

“With great power comes greater responsibility”Concluding Remarks

• Powerful new animation and snapshot APIs can be used to create awesome transition animations

Page 225: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

“With great power comes greater responsibility”Concluding Remarks

• Powerful new animation and snapshot APIs can be used to create awesome transition animations•Many view controller transition animations can be customized

■ UICollectionViewControllers and UICollectionViews can be easily used to define custom transitions

■ The protocol based expression of this API is very flexible

Page 226: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

“With great power comes greater responsibility”Concluding Remarks

• Powerful new animation and snapshot APIs can be used to create awesome transition animations•Many view controller transition animations can be customized

■ UICollectionViewControllers and UICollectionViews can be easily used to define custom transitions

■ The protocol based expression of this API is very flexible

• View controller transitions can be interactive■ Is it viewWillAppear: or viewWillProbablyAppear: ?

Page 227: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

“With great power comes greater responsibility”Concluding Remarks

• Powerful new animation and snapshot APIs can be used to create awesome transition animations•Many view controller transition animations can be customized

■ UICollectionViewControllers and UICollectionViews can be easily used to define custom transitions

■ The protocol based expression of this API is very flexible

• View controller transitions can be interactive■ Is it viewWillAppear: or viewWillProbablyAppear: ?

•A transition coordinator can be used with/without custom transitions■ animateAlongsideTransition:completion:■ notifyWhenInteractionEndsUsingBlock:

Page 228: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

More Information

Jake BehrensApp Frameworks [email protected]

Documentation and Sample CodeiOS Dev Centerhttp://developer.apple.com

Apple Developer Forumshttp://devforums.apple.com

Page 229: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Related Sessions

Building User Interfaces for iOS 7 PresidioTuesday 10:15AM

Advance Techniques with UIKit Dynamics PresidioThursday 3:15PM

Getting Started with UIKit Dynamics PresidioTuesday 4:30PM

Best Practices for Great iOS UI Design PresidioFriday 10:15AM

Page 230: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController

Labs

Cocoa Touch Animation Lab Frameworks Lab BThursday 2:00PM

Page 231: Custom Transitions Using View Controllers · Custom view controller transitions Roadmap •Which transitions can be customized? Presentations and dismissals UITabBarController UINavigationController