implementing engaging ui on ios - apple inc. · these are confidential sessions—please refrain...

113
These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging UI on iOS Brandon Newendorp iOS Software Engineer Jim Turner iOS Software Engineer

Upload: others

Post on 01-Oct-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

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

Make it so

Session 226

Implementing Engaging UI on iOS

Brandon NewendorpiOS Software Engineer

Jim TurneriOS Software Engineer

Page 2: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging
Page 3: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging
Page 4: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging
Page 5: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging
Page 6: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging
Page 7: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

Agenda

• Transitions• Custom appearance• Realistic motion

Page 8: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

Custom View Controller Transitions

Page 9: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging
Page 10: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging
Page 11: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

Going beyond animated:YESUIViewController Transitions

• New API to customize view controller transitions• UIViewController present and dismiss• Navigation push/pop• Interactive and non-interactive

Page 12: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging
Page 13: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging
Page 14: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

toVC = [[PhotoDetailView alloc] init];

Page 15: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

toVC = [[PhotoDetailView alloc] init];

Page 16: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

toVC.transitioningDelegate = self

Page 17: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

toVC.transitioningDelegate = self

Page 18: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

presentViewController:toVCanimated:YEScompletion:nil

Page 19: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

presentViewController:toVCanimated:YEScompletion:nil

Page 20: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging
Page 21: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

animationControllerForPresentedController:presentingController:sourceController:

Page 22: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

animationControllerForPresentedController:presentingController:sourceController:

animationControllerForPresentedController:

Page 23: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

animationControllerForPresentedController:presentingController:sourceController:presentingController:

Page 24: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

animationControllerForPresentedController:presentingController:sourceController:sourceController:

Page 25: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

animationControllerForPresentedController:presentingController:sourceController:

Page 26: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

animationControllerForPresentedController:presentingController:sourceController:

id<UIViewControllerAnimatedTransitioning>

transitionDuration:animateTransition:

Page 27: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging
Page 28: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

UIPercentDrivenInteractiveTransitionUIViewController Transitions

• Provided object for interactive transitions• Update the transition based on touch or other input• Vary completionSpeed and completionCurve to change behavior

Page 29: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging
Page 30: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging
Page 31: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

What it’s good forUISnapshotting

• Improvement on -[CALayer renderInContext:]• Representation of a view’s currently rendered contents• Very fast• Useful in animations• Creating special effects

Page 32: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

UISnapshotting

Page 33: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

UISnapshotting

Page 34: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

renderInContext:

snapshotView:

0 225 450 675 900

145

56

844

Milliseconds (ms)

Faster and betterUISnapshotting

Page 35: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

renderInContext:

snapshotView:

0 225 450 675 900

145

56

844

Milliseconds (ms)

844

Faster and betterUISnapshotting

Page 36: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

renderInContext:

snapshotView:

0 225 450 675 900

145

56

844

Milliseconds (ms)

844

56

Faster and betterUISnapshotting

Page 37: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

APIUISnapshotting

- (UIView *)snapshotView- (UIView *)resizableSnapshotViewFromRect:(CGRect)rect withCapInsets:(UIEdgeInsets)capInsets

Page 38: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

APIUISnapshotting

- (UIView *)snapshotView- (UIView *)resizableSnapshotViewFromRect:(CGRect)rect withCapInsets:(UIEdgeInsets)capInsets

- (BOOL)drawViewHierarchyInRect:(CGRect)rect

Page 39: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

renderInContext:

snapshotView:

0 225 450 675 900

145

56

844

Milliseconds (ms)

Faster and betterUISnapshotting

56

Page 40: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

renderInContext:

snapshotView:

0 225 450 675 900

145

56

844

Milliseconds (ms)

Faster and betterUISnapshotting

drawViewHierarchyInRect:

56

Page 41: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

renderInContext:

snapshotView:

0 225 450 675 900

145

56

844

Milliseconds (ms)

145

Faster and betterUISnapshotting

drawViewHierarchyInRect:

56

Page 42: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

Making a Blurred Background

UIGraphicsBeginImageContextWithOptions(image.size, NULL, 0);

[view drawViewHierarchyInRect:rect];

UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

lightImage = [newImage applyLightEffect];

Page 43: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

Making a Blurred Background

UIGraphicsBeginImageContextWithOptions(image.size, NULL, 0);

[view drawViewHierarchyInRect:rect];

UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

lightImage = [newImage applyLightEffect];

Page 44: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

Making a Blurred Background

UIGraphicsBeginImageContextWithOptions(image.size, NULL, 0);

[view drawViewHierarchyInRect:rect];

UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

lightImage = [newImage applyLightEffect];

Page 45: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

Making a Blurred Background

UIGraphicsBeginImageContextWithOptions(image.size, NULL, 0);

[view drawViewHierarchyInRect:rect];

UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

lightImage = [newImage applyLightEffect];

Page 46: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

Making a Blurred Background

UIGraphicsBeginImageContextWithOptions(image.size, NULL, 0);

[view drawViewHierarchyInRect:rect];

UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

lightImage = [newImage applyLightEffect];

Page 47: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

Making a Blurred Background

UIGraphicsBeginImageContextWithOptions(image.size, NULL, 0);

[view drawViewHierarchyInRect:rect];

UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

lightImage = [newImage applyLightEffect];

Page 48: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

Making a Blurred Background

UIGraphicsBeginImageContextWithOptions(image.size, NULL, 0);

[view drawViewHierarchyInRect:rect];

UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

lightImage = [newImage applyLightEffect];

Page 49: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

Making a Blurred Background

UIGraphicsBeginImageContextWithOptions(image.size, NULL, 0);

[view drawViewHierarchyInRect:rect];

UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

lightImage = [newImage applyLightEffect];

Page 50: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

Making a Blurred Background

UIGraphicsBeginImageContextWithOptions(image.size, NULL, 0);

[view drawViewHierarchyInRect:rect];

UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

lightImage = [newImage applyLightEffect];

Page 51: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

Making a Blurred Background

UIGraphicsBeginImageContextWithOptions(image.size, NULL, 0);

[view drawViewHierarchyInRect:rect];

UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

lightImage = [newImage applyLightEffect];

Page 52: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

Better than everAppearance Customization

Page 53: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging
Page 54: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

[[UISlider appearance] setTintColor:[UIColor redColor]]

Page 55: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging
Page 56: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

[self.window setTintColor:[UIColor redColor]]

Page 57: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

UIAppearanceAppearance Customization

+ (instancetype)appearance

+ (instancetype)appearanceWhenContainedIn:

Page 58: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

Appearance Customization

+ (instancetype)appearance

+ (instancetype)appearanceWhenContainedIn:

- (UIColor *)tintColor

- (UIColor *)barTintColor

Page 59: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

Appearance Customization

- [UIImage imageWithRenderingMode:]

Page 60: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

Appearance Customization

- [UIImage imageWithRenderingMode:]

Page 61: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

Appearance Customization

- [UIImage imageWithRenderingMode:]

UIImageRenderingModeAutomatic

Page 62: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

Appearance Customization

- [UIImage imageWithRenderingMode:]

UIImageRenderingModeAutomatic

UIImageRenderingModeAlwaysOriginal

Page 63: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

Appearance Customization

- [UIImage imageWithRenderingMode:]

UIImageRenderingModeAutomatic

UIImageRenderingModeAlwaysOriginal

UIImageRenderingModeAlwaysTemplate

Page 64: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

Original image

Page 65: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal

Page 66: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate

Page 67: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate[window setTintColor:[UIColor redColor]];

Page 68: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate[window setTintColor:[UIColor blueColor]];

Page 69: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate[window setTintColor:[UIColor blueColor]];

Page 70: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate[window setTintColor:[UIColor blueColor]];

Page 71: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging
Page 72: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging
Page 73: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

- [UIImage resizableImageWithCapInsets:]

Page 74: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

- [UIImage resizableImageWithCapInsets:]

5pt

5pt 5pt

5pt

Page 75: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

- [UIImage resizableImageWithCapInsets:]

5pt

5pt 5pt

5pt

Page 76: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

- [UIImage resizableImageWithCapInsets:]

5pt

5pt 5pt

5pt

Page 77: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

- [UIImage resizableImageWithCapInsets:]

今日はGuten Tag

5pt

5pt 5pt

5pt

Page 78: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

- [UIImage resizableImageWithCapInsets:]

Hello今日はGuten Tag

Page 79: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

- [UIImage resizableImageWithCapInsets:]

今日はGuten Tag

Page 80: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

- [UIImage resizableImageWithCapInsets:]

Hello今日はGuten Tag

Page 81: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging
Page 82: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

UIKit Dynamics and Motion EffectsRealistic Motion

Page 83: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

With great power comes great responsibilityUIKit Dynamics

• Model real world physical behaviors• Not a physics engine• Most effective when used in moderation

Page 84: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging
Page 85: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging
Page 86: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging
Page 87: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging
Page 88: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging
Page 89: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging
Page 90: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging
Page 91: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging
Page 92: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging
Page 93: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging
Page 94: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

The basicsUIKit Dynamics

animator = [[UIDynamicAnimator alloc] initWithReferenceView:self.view];

gravityBehavior = [[UIGravityBehavior alloc] initWithItems:@[itemToAnimate]];

[animator addBehavior:gravityBehavior];

Page 95: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

The basicsUIKit Dynamics

animator = [[UIDynamicAnimator alloc] initWithReferenceView:self.view];

gravityBehavior = [[UIGravityBehavior alloc] initWithItems:@[itemToAnimate]];

[animator addBehavior:gravityBehavior];

Page 96: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

The basicsUIKit Dynamics

animator = [[UIDynamicAnimator alloc] initWithReferenceView:self.view];

gravityBehavior = [[UIGravityBehavior alloc] initWithItems:@[itemToAnimate]];

[animator addBehavior:gravityBehavior];

Page 97: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

The basicsUIKit Dynamics

animator = [[UIDynamicAnimator alloc] initWithReferenceView:self.view];

gravityBehavior = [[UIGravityBehavior alloc] initWithItems:@[itemToAnimate]];

[animator addBehavior:gravityBehavior];

Page 98: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging
Page 99: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

UIMotionEffectMotion Effects

• Create effects like the home screen or action sheets

• Device motion is the input• Optimized for power efficiency• Don’t roll your own

Page 100: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

Understanding directionsMotion Effects

1-1

-1

1

Page 101: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

Understanding directionsMotion Effects

1-1

-1

1

Page 102: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

Understanding directionsMotion Effects

1-1

-1

1

Page 103: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

Understanding directionsMotion Effects

1-1

-1

1

Page 104: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

Understanding directionsMotion Effects

1-1

-1

1

Page 105: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

Understanding directionsMotion Effects

1-1

-1

1

Page 106: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

UIInterpolatingMotionEffectMotion Effects

• Interpolate between two values• Defined by a key path• Updates based on device motion• Attach UIMotionEffects to a UIView

Page 107: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

Advanced behaviorsMotion Effects

UIMotionEffectGroup

Page 108: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

Advanced behaviorsMotion Effects

- (NSDictionary *) keyPathsAndRelativeValuesForViewerOffset:(UIOffset)viewerOffset

Page 109: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging
Page 110: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

Wrap Up

• Customize UIViewController transitions• App-wide appearance• Resizable and template images• UIKit Dynamics• UIMotionEffect

Page 111: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

Related Sessions

Building User Interfaces for iOS 7 PresidioTuesday 10:15 AM

Customizing Your App’s Appearance for iOS 7 PresidioWednesday 3:15PM

Getting Started with UIKit Dynamics PresidioTuesday 4:30PM

Custom Transitions Using View Controllers Pacific HeightsThursday 11:30 AM

Advanced Techniques with UIKit Dynamics PresidioThursday 3:15PM

Page 112: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging

More Information

Jake BehrensApp Frameworks [email protected]

DocumentationUIDynamicAnimator Class ReferenceUIPercentDrivenInteractiveTransition Class ReferenceUIAppearance Protocol ReferenceUIViewControllerTransitioning Delegate Protocol ReferenceView Controller Programming Guide for iOSUIMotionEffect Class Referencehttp://developer.apple.com/

Apple Developer Forumshttp://devforums.apple.com

Page 113: Implementing Engaging UI on iOS - Apple Inc. · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Make it so Session 226 Implementing Engaging