Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please...
Transcript of Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please...
![Page 1: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/1.jpg)
These are confidential sessions—please refrain from streaming, blogging, or taking pictures
Session 206
Getting Started with UIKit Dynamics
Olivier GutknechtiOS Applications & Frameworks Engineer
![Page 2: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/2.jpg)
What we will coverAgenda
![Page 3: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/3.jpg)
What we will coverAgenda
• Core concepts
![Page 4: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/4.jpg)
What we will coverAgenda
• Core concepts• Predefined behaviors
![Page 5: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/5.jpg)
What we will coverAgenda
• Core concepts• Predefined behaviors• Best practices
![Page 6: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/6.jpg)
Animations and Interactions on iOS
![Page 7: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/7.jpg)
Animations and Interactions on iOS
• Core Animation
![Page 8: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/8.jpg)
Animations and Interactions on iOS
• Core Animation• UIView animations
![Page 9: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/9.jpg)
Animations and Interactions on iOS
• Core Animation• UIView animations• Motion effects
![Page 10: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/10.jpg)
Animations and Interactions on iOS
• Core Animation• UIView animations• Motion effects• Gesture driven interactions
![Page 11: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/11.jpg)
Animations and Interactions on iOS
• Core Animation• UIView animations• Motion effects• Gesture driven interactions• CADisplayLink
![Page 12: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/12.jpg)
Animations and Interactions on iOS
• Core Animation• UIView animations• Motion effects• Gesture driven interactions• CADisplayLink• All of above
![Page 13: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/13.jpg)
What Is UIKit Dynamics?
![Page 14: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/14.jpg)
What Is UIKit Dynamics?A composable, reusable, declarative,
real-world inspired animation, and interaction system
![Page 15: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/15.jpg)
UIKit Games
![Page 16: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/16.jpg)
UIKit Games
![Page 17: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/17.jpg)
UIKit Games
![Page 18: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/18.jpg)
UIKit Games
![Page 19: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/19.jpg)
UIKit Games
![Page 20: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/20.jpg)
![Page 21: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/21.jpg)
Sprite Kit
Introduction to Sprite Kit PresidioWednesday 11:30AM
![Page 22: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/22.jpg)
Demo
![Page 23: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/23.jpg)
How Complex Is This?Entire application: 400 lines of code
![Page 24: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/24.jpg)
How Complex Is This?Entire application: 400 lines of code
80%
20%
DynamicsNon Dynamics
![Page 25: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/25.jpg)
Overview
![Page 26: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/26.jpg)
Why?
![Page 27: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/27.jpg)
• Real world inspired interactions
Why?
![Page 28: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/28.jpg)
• Real world inspired interactions• Combining predefined and interactive animations
Why?
![Page 29: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/29.jpg)
• Real world inspired interactions• Combining predefined and interactive animations
• Designed for UI
Why?
![Page 30: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/30.jpg)
• Real world inspired interactions• Combining predefined and interactive animations
• Designed for UI
Why?
![Page 31: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/31.jpg)
• Real world inspired interactions• Combining predefined and interactive animations
• Designed for UI
Why?
![Page 32: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/32.jpg)
How?
![Page 33: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/33.jpg)
How?
• High-level expression[myView setMass:0.42] ?
![Page 34: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/34.jpg)
How?
• High-level expression[myView setMass:0.42] ?
![Page 35: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/35.jpg)
How?
• High-level expression• Composition of…
![Page 36: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/36.jpg)
How?
• High-level expression• Composition of…
■ Primitive behaviors
![Page 37: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/37.jpg)
How?
• High-level expression• Composition of…
■ Primitive behaviors
• Animation context
![Page 38: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/38.jpg)
Architecture
UIDynamicAnimator
![Page 39: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/39.jpg)
UIDynamicBehaviorUIDynamicBehavior UIDynamicBehavior
Architecture
UIDynamicAnimator
![Page 40: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/40.jpg)
UIDynamicBehaviorUIDynamicBehavior UIDynamicBehavior
Architecture
UIDynamicAnimator
View View View
![Page 41: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/41.jpg)
UIDynamicBehaviorUIDynamicBehavior UIDynamicBehavior
Architecture
UIDynamicAnimator
View View View
Reference View
![Page 42: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/42.jpg)
UIDynamicBehaviorUIDynamicBehavior UIDynamicBehavior
Architecture
UIDynamicAnimator
View View View
Reference View
![Page 43: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/43.jpg)
UIDynamicBehaviorUIDynamicBehavior UIDynamicBehavior
Architecture
UIDynamicAnimator
View View View
Reference View
![Page 44: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/44.jpg)
UIDynamicAnimator
Reference View
UIDynamicAnimator
![Page 45: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/45.jpg)
UIDynamicAnimator
• Provide the overall context
Reference View
UIDynamicAnimator
![Page 46: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/46.jpg)
UIDynamicAnimator
• Provide the overall context• Define the coordinate system
Reference View
UIDynamicAnimator
![Page 47: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/47.jpg)
UIDynamicAnimator
• Provide the overall context• Define the coordinate system• Control the engine Reference View
UIDynamicAnimator
![Page 48: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/48.jpg)
UIDynamicAnimator
• Provide the overall context• Define the coordinate system• Control the engine• Keep track of behaviors
Reference View
UIDynamicAnimator
![Page 49: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/49.jpg)
UIDynamicAnimator
• Provide the overall context• Define the coordinate system• Control the engine• Keep track of behaviors
Reference View
UIDynamicAnimator
animator = [[UIDynamicAnimator alloc] initWithReferenceView:referenceView];
[animator addBehavior:...];[animator addBehavior:...];
![Page 50: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/50.jpg)
Reference View
UIDynamicBehavior
UIDynamicAnimator
![Page 51: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/51.jpg)
Reference View
UIDynamicBehavior
UIDynamicBehavior
UIDynamicAnimator
![Page 52: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/52.jpg)
Reference View
UIDynamicBehavior
View
UIDynamicBehavior
UIDynamicAnimator
![Page 53: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/53.jpg)
• Declarative
Reference View
UIDynamicBehavior
View
UIDynamicBehavior
UIDynamicAnimator
![Page 54: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/54.jpg)
• Declarative• Describe “influences” on views
Reference View
UIDynamicBehavior
View
UIDynamicBehavior
UIDynamicAnimator
![Page 55: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/55.jpg)
• Declarative• Describe “influences” on views• Added and removed at any time Reference View
UIDynamicBehavior
View
UIDynamicBehavior
UIDynamicAnimator
![Page 56: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/56.jpg)
• Declarative• Describe “influences” on views• Added and removed at any time• Composable
Reference View
UIDynamicBehavior
View
UIDynamicBehavior
UIDynamicAnimator
![Page 57: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/57.jpg)
• Declarative• Describe “influences” on views• Added and removed at any time• Composable• Subclassable
Reference View
UIDynamicBehavior
View
UIDynamicBehavior
UIDynamicAnimator
![Page 58: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/58.jpg)
• Declarative• Describe “influences” on views• Added and removed at any time• Composable• Subclassable
Reference View
UIDynamicBehavior
View
UIDynamicBehavior
UIDynamicAnimator
myBehavior = [[MyBehavior alloc] initWith...];
[animator addBehavior:myBehavior];
![Page 59: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/59.jpg)
Primitive Behaviors
![Page 60: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/60.jpg)
Common Traits
• Configured with items to animate
![Page 61: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/61.jpg)
Common Traits
• Configured with items to animate• Most primitive behaviors support adding and removing items
![Page 62: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/62.jpg)
Common Traits
• Configured with items to animate• Most primitive behaviors support adding and removing items• Can be parametrized before adding to an animator
![Page 63: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/63.jpg)
Common Traits
• Configured with items to animate• Most primitive behaviors support adding and removing items• Can be parametrized before adding to an animator• The influence stops when the behavior is removed
![Page 64: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/64.jpg)
A rich set of composable classesPredefined Behaviors
![Page 65: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/65.jpg)
A rich set of composable classesPredefined Behaviors
• Gravity
![Page 66: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/66.jpg)
A rich set of composable classesPredefined Behaviors
• Gravity• Collision
![Page 67: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/67.jpg)
A rich set of composable classesPredefined Behaviors
• Gravity• Collision• Attachments
![Page 68: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/68.jpg)
A rich set of composable classesPredefined Behaviors
• Gravity• Collision• Attachments• Snap
![Page 69: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/69.jpg)
A rich set of composable classesPredefined Behaviors
• Gravity• Collision• Attachments• Snap• Forces
![Page 70: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/70.jpg)
A rich set of composable classesPredefined Behaviors
• Gravity• Collision• Attachments• Snap• Forces• Item properties
![Page 71: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/71.jpg)
UIGravityBehavior
![Page 72: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/72.jpg)
UIGravityBehavior
![Page 73: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/73.jpg)
UIGravityBehavior
• A simple gravity vector
![Page 74: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/74.jpg)
UIGravityBehavior
• A simple gravity vector@property (readwrite,nonatomic) CGFloat xComponent;@property (readwrite,nonatomic) CGFloat yComponent;
![Page 75: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/75.jpg)
UIGravityBehavior
• A simple gravity vector@property (readwrite,nonatomic) CGFloat xComponent;@property (readwrite,nonatomic) CGFloat yComponent;
• UIKit coordinate system
![Page 76: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/76.jpg)
UIGravityBehavior
• A simple gravity vector@property (readwrite,nonatomic) CGFloat xComponent;@property (readwrite,nonatomic) CGFloat yComponent;
• UIKit coordinate system■ (0,1) by default
![Page 77: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/77.jpg)
UIGravityBehavior
• A simple gravity vector@property (readwrite,nonatomic) CGFloat xComponent;@property (readwrite,nonatomic) CGFloat yComponent;
• UIKit coordinate system■ (0,1) by default
• Items can be added and removed at any time
![Page 78: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/78.jpg)
UIGravityBehavior
• A simple gravity vector@property (readwrite,nonatomic) CGFloat xComponent;@property (readwrite,nonatomic) CGFloat yComponent;
• UIKit coordinate system■ (0,1) by default
• Items can be added and removed at any time
g = [[UIGravityBehavior alloc] initWithItems:@[v]];
[animator addBehavior:g];
![Page 79: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/79.jpg)
A Well-known Constant…Earth Gravity
![Page 80: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/80.jpg)
A Well-known Constant…Earth Gravity9.80665 m/s²
![Page 81: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/81.jpg)
Introducing…UIKit Gravity
![Page 82: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/82.jpg)
Introducing…UIKit Gravity
1000 p/s²
![Page 83: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/83.jpg)
UICollisionBehavior
![Page 84: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/84.jpg)
UICollisionBehavior
• Between a view and a boundary
![Page 85: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/85.jpg)
UICollisionBehavior
• Between a view and a boundary
![Page 86: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/86.jpg)
UICollisionBehavior
• Between a view and a boundary• Or between views associated to the same behavior
![Page 87: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/87.jpg)
UICollisionBehavior
• Between a view and a boundary• Or between views associated to the same behavior
![Page 88: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/88.jpg)
UICollisionBehavior
• Between a view and a boundary• Or between views associated to the same behavior
• Or both, by default
![Page 89: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/89.jpg)
UICollisionBehavior
• Between a view and a boundary• Or between views associated to the same behavior
• Or both, by default
![Page 90: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/90.jpg)
UICollisionBehavior
• Collision mode@property (nonatomic, readwrite) UICollisionBehaviorMode collisionMode;
UICollisionBehaviorModeItemsUICollisionBehaviorModeBoundariesUICollisionBehaviorModeEverything
![Page 91: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/91.jpg)
UICollisionBehavior
• Collision mode@property (nonatomic, readwrite) UICollisionBehaviorMode collisionMode;
UICollisionBehaviorModeItemsUICollisionBehaviorModeBoundariesUICollisionBehaviorModeEverything
• Items can be added or removed at any time
![Page 92: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/92.jpg)
UICollisionBehavior
• Collision mode@property (nonatomic, readwrite) UICollisionBehaviorMode collisionMode;
UICollisionBehaviorModeItemsUICollisionBehaviorModeBoundariesUICollisionBehaviorModeEverything
• Items can be added or removed at any time
![Page 93: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/93.jpg)
UICollisionBehavior
• You can create multiple collision behaviors■ “red views collide with red views, green views with green views”
![Page 94: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/94.jpg)
UICollisionBehavior
• You can create multiple collision behaviors■ “red views collide with red views, green views with green views”
• A word of warning: collisions have a CPU cost
![Page 95: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/95.jpg)
BoundariesUICollisionBehavior
• Easy setup using the reference view@property (nonatomic, readwrite) BOOL translatesReferenceBoundsIntoBoundary;
![Page 96: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/96.jpg)
BoundariesUICollisionBehavior
• Easy setup using the reference view@property (nonatomic, readwrite) BOOL translatesReferenceBoundsIntoBoundary;
• Or with insets-(void)setTranslatesReferenceBoundsIntoBoundaryWithInsets:(UIEdgeInsets)insets;
![Page 97: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/97.jpg)
BoundariesUICollisionBehavior
![Page 98: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/98.jpg)
BoundariesUICollisionBehavior
• Explicitly with segments - (void)addBoundaryWithIdentifier:(id)identifier fromPoint:(CGPoint)p1 toPoint:(CGPoint)p2;
![Page 99: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/99.jpg)
BoundariesUICollisionBehavior
• Explicitly with segments - (void)addBoundaryWithIdentifier:(id)identifier fromPoint:(CGPoint)p1 toPoint:(CGPoint)p2;
• Or paths (approximated)- (void)addBoundaryWithIdentifier:(id)identifier forPath:(UIBezierPath*)p;
![Page 100: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/100.jpg)
BoundariesUICollisionBehavior
• Explicitly with segments - (void)addBoundaryWithIdentifier:(id)identifier fromPoint:(CGPoint)p1 toPoint:(CGPoint)p2;
• Or paths (approximated)- (void)addBoundaryWithIdentifier:(id)identifier forPath:(UIBezierPath*)p;
c = [[UICollisionBehavior alloc] initWithItems:@[view];
[c addBoundaryWithIdentifier:@”Wall1” fromPoint:p1 toPoint:p2];[c addBoundaryWithIdentifier:@”Wall2” fromPoint:p3 toPoint:p4];
![Page 101: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/101.jpg)
UICollisionBehaviorDelegate
• Callback on begin and end of contact
![Page 102: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/102.jpg)
UICollisionBehaviorDelegate
• Callback on begin and end of contact• Between views- collisionBehavior: beganContactForItem: withItem: atPoint:- collisionBehavior: endedContactForItem: withItem:
![Page 103: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/103.jpg)
UICollisionBehaviorDelegate
• Callback on begin and end of contact• Between views- collisionBehavior: beganContactForItem: withItem: atPoint:- collisionBehavior: endedContactForItem: withItem:
• Or boundaries- collisionBehavior: beganContactForItem: withBoundaryIdentifier: atPoint:- collisionBehavior: endedContactForItem: withBoundaryIdentifier:
![Page 104: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/104.jpg)
UICollisionBehaviorDelegate
• Callback on begin and end of contact• Between views- collisionBehavior: beganContactForItem: withItem: atPoint:- collisionBehavior: endedContactForItem: withItem:
• Or boundaries- collisionBehavior: beganContactForItem: withBoundaryIdentifier: atPoint:- collisionBehavior: endedContactForItem: withBoundaryIdentifier:
• The reference boundary identifier is always nil
![Page 105: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/105.jpg)
UIAttachmentBehavior
![Page 106: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/106.jpg)
UIAttachmentBehavior
• Between a view and an anchor point
![Page 107: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/107.jpg)
UIAttachmentBehavior
• Between a view and an anchor point a1 = [[UIAttachmentBehavior alloc] initWithItem:v1 attachedToAnchor:ap];
![Page 108: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/108.jpg)
UIAttachmentBehavior
• Between a view and an anchor point a1 = [[UIAttachmentBehavior alloc] initWithItem:v1 attachedToAnchor:ap];
• Between two views
![Page 109: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/109.jpg)
UIAttachmentBehavior
• Between a view and an anchor point a1 = [[UIAttachmentBehavior alloc] initWithItem:v1 attachedToAnchor:ap];
• Between two viewsa2 = [[UIAttachmentBehavior alloc] initWithItem:v1 attachedToItem:v2];
![Page 110: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/110.jpg)
UIAttachmentBehavior
![Page 111: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/111.jpg)
UIAttachmentBehavior
• The view attachment point can be an offset from the centera1 = [[UIAttachmentBehavior alloc] initWithItem:v1 point:p1 attachedToAnchor:ap];a2 = [[UIAttachmentBehavior alloc] initWithItem:v1 point:p2 attachedToItem:v2];
![Page 112: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/112.jpg)
UIAttachmentBehavior
![Page 113: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/113.jpg)
UIAttachmentBehavior
![Page 114: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/114.jpg)
UIAttachmentBehavior
• An attachment can act as a spring[a setFrequency:4.0];[a setDamping:0.5];
![Page 115: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/115.jpg)
UIAttachmentBehavior
• An attachment can act as a spring[a setFrequency:4.0];[a setDamping:0.5];
• An anchor point can be modified later
![Page 116: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/116.jpg)
UIAttachmentBehavior
• An attachment can act as a spring[a setFrequency:4.0];[a setDamping:0.5];
• An anchor point can be modified later• Only use length if to change the distance after setup
![Page 117: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/117.jpg)
UIAttachmentBehavior
• An attachment can act as a spring[a setFrequency:4.0];[a setDamping:0.5];
• An anchor point can be modified later• Only use length if to change the distance after setup
• Attachments are invisible!
![Page 118: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/118.jpg)
Demo
![Page 119: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/119.jpg)
UISnapBehavior
![Page 120: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/120.jpg)
UISnapBehavior
• Snap a view in place
![Page 121: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/121.jpg)
UISnapBehavior
• Snap a view in place
![Page 122: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/122.jpg)
UISnapBehavior
• Snap a view in place• Ensure position and angle
![Page 123: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/123.jpg)
UISnapBehavior
• Snap a view in place• Ensure position and angle• Damping is customizable
![Page 124: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/124.jpg)
UISnapBehavior
• Snap a view in place• Ensure position and angle• Damping is customizable
s = [[UISnapBehavior alloc] initWithItem:v snapToPoint:p];[animator addBehavior:s];
![Page 125: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/125.jpg)
UIPushBehavior
![Page 126: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/126.jpg)
UIPushBehavior
![Page 127: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/127.jpg)
UIPushBehavior
• Apply a force to a view (or views)p = [[UIPushBehavior alloc] initWithItems:@[view] mode:UIPushBehaviorModeContinuous];
![Page 128: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/128.jpg)
UIPushBehavior
• Apply a force to a view (or views)p = [[UIPushBehavior alloc] initWithItems:@[view] mode:UIPushBehaviorModeContinuous];
• A simple force vector@property (readwrite,nonatomic) CGFloat xComponent;@property (readwrite,nonatomic) CGFloat yComponent;
@property (readwrite,nonatomic) CGFloat angle;@property (readwrite,nonatomic) CGFloat magnitude;
![Page 129: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/129.jpg)
UIPushBehavior
• Apply a force to a view (or views)p = [[UIPushBehavior alloc] initWithItems:@[view] mode:UIPushBehaviorModeContinuous];
• A simple force vector@property (readwrite,nonatomic) CGFloat xComponent;@property (readwrite,nonatomic) CGFloat yComponent;
@property (readwrite,nonatomic) CGFloat angle;@property (readwrite,nonatomic) CGFloat magnitude;
• The target point can be customized[p setTargetPoint:x forItem:view];
![Page 130: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/130.jpg)
UIPushBehavior
• Apply a force to a view (or views)p = [[UIPushBehavior alloc] initWithItems:@[view] mode:UIPushBehaviorModeContinuous];
• A simple force vector@property (readwrite,nonatomic) CGFloat xComponent;@property (readwrite,nonatomic) CGFloat yComponent;
@property (readwrite,nonatomic) CGFloat angle;@property (readwrite,nonatomic) CGFloat magnitude;
• The target point can be customized[p setTargetPoint:x forItem:view];
![Page 131: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/131.jpg)
UIPushBehavior
• Apply a force to a view (or views)p = [[UIPushBehavior alloc] initWithItems:@[view] mode:UIPushBehaviorModeContinuous];
• A simple force vector@property (readwrite,nonatomic) CGFloat xComponent;@property (readwrite,nonatomic) CGFloat yComponent;
@property (readwrite,nonatomic) CGFloat angle;@property (readwrite,nonatomic) CGFloat magnitude;
• The target point can be customized[p setTargetPoint:x forItem:view];
![Page 132: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/132.jpg)
![Page 133: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/133.jpg)
A Well-known Unit…The Newton
![Page 134: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/134.jpg)
A Well-known Unit…The Newton
Accelerate 1kg at a rate of 1m/s²
![Page 135: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/135.jpg)
Introducing…The UIKit Newton
![Page 136: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/136.jpg)
Introducing…The UIKit Newton
Accelerate a (100,100) view to 100 p/s²
![Page 137: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/137.jpg)
UIPushBehavior
![Page 138: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/138.jpg)
UIPushBehavior
• Instantaneous modep2 = [[UIPushBehavior alloc] initWithItems:@[view] mode:UIPushBehaviorModeInstantaneous];
![Page 139: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/139.jpg)
UIPushBehavior
• Instantaneous modep2 = [[UIPushBehavior alloc] initWithItems:@[view] mode:UIPushBehaviorModeInstantaneous];
• Velocity change is instantaneous
![Page 140: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/140.jpg)
UIPushBehavior
• Instantaneous modep2 = [[UIPushBehavior alloc] initWithItems:@[view] mode:UIPushBehaviorModeInstantaneous];
• Velocity change is instantaneous
![Page 141: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/141.jpg)
UIPushBehavior
• Instantaneous modep2 = [[UIPushBehavior alloc] initWithItems:@[view] mode:UIPushBehaviorModeInstantaneous];
• Velocity change is instantaneous• Automatically disables itself after
■ Reenable with [p setActive:TRUE]
![Page 142: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/142.jpg)
Demo
![Page 143: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/143.jpg)
UIDynamicItemBehavior
![Page 144: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/144.jpg)
UIDynamicItemBehavior
• Applied to one or many items
![Page 145: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/145.jpg)
UIDynamicItemBehavior
• Applied to one or many items• Change item-level propertiesfrictionresistanceangularResistanceelasticitydensityallowsRotation
![Page 146: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/146.jpg)
UIDynamicItemBehavior
• Applied to one or many items• Change item-level propertiesfrictionresistanceangularResistanceelasticitydensityallowsRotation
![Page 147: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/147.jpg)
UIDynamicItemBehavior
• Applied to one or many items• Change item-level propertiesfrictionresistanceangularResistanceelasticitydensityallowsRotation
• Directly add angular or linear velocities■ i.e. map with a previous gesture
![Page 148: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/148.jpg)
Applying Dynamics
![Page 149: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/149.jpg)
Applying Dynamics
• Add and remove views to behaviors
![Page 150: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/150.jpg)
Applying Dynamics
• Add and remove views to behaviors• Configure, add, and remove behaviors to an animator
![Page 151: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/151.jpg)
Applying Dynamics
• Add and remove views to behaviors• Configure, add, and remove behaviors to an animator• There is no step 3
![Page 152: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/152.jpg)
Don’t Expect the Impossible
• You can create setups which don’t have solutions
• Build your system iteratively• Not a physics-accurate tool
![Page 153: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/153.jpg)
Don’t Expect the Impossible
• You can create setups which don’t have solutions
• Build your system iteratively• Not a physics-accurate tool
![Page 154: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/154.jpg)
Don’t Expect the Impossible
• You can create setups which don’t have solutions
• Build your system iteratively• Not a physics-accurate tool
![Page 155: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/155.jpg)
Don’t Expect the Impossible
• You can create setups which don’t have solutions
• Build your system iteratively• Not a physics-accurate tool
![Page 156: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/156.jpg)
Don’t Expect the Impossible
• You can create setups which don’t have solutions
• Build your system iteratively
![Page 157: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/157.jpg)
Don’t Expect the Impossible
• You can create setups which don’t have solutions
• Build your system iteratively• Not a physics-accurate tool
![Page 158: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/158.jpg)
Dynamic Items
![Page 159: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/159.jpg)
UIDynamicItem Protocol
![Page 160: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/160.jpg)
UIDynamicItem Protocol
• A protocol for items associated to predefined behaviors
![Page 161: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/161.jpg)
UIDynamicItem Protocol
• A protocol for items associated to predefined behaviors• Describe what UIKit needs to animate an item
![Page 162: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/162.jpg)
UIDynamicItem Protocol
• A protocol for items associated to predefined behaviors• Describe what UIKit needs to animate an item
![Page 163: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/163.jpg)
UIDynamicItem Protocol
• A protocol for items associated to predefined behaviors• Describe what UIKit needs to animate an item
![Page 164: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/164.jpg)
UIDynamicItem Protocol
• A protocol for items associated to predefined behaviors• Describe what UIKit needs to animate an item
![Page 165: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/165.jpg)
UIDynamicItem Protocol
• A protocol for items associated to predefined behaviors• Describe what UIKit needs to animate an item
![Page 166: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/166.jpg)
UIDynamicItem Protocol
• A protocol for items associated to predefined behaviors• Describe what UIKit needs to animate an item• UIView implements it
![Page 167: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/167.jpg)
UIDynamicItem Protocol
• A protocol for items associated to predefined behaviors• Describe what UIKit needs to animate an item• UIView implements it• You can implement it
![Page 168: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/168.jpg)
UIDynamicItem
@protocol UIDynamicItem <NSObject>
@property (nonatomic, readwrite) CGPoint center;@property (nonatomic, readonly) CGRect bounds;@property (nonatomic, readwrite) CGAffineTransform transform;
@end
![Page 169: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/169.jpg)
Collection View Layout Attributes
![Page 170: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/170.jpg)
Dynamics and UICollectionView
![Page 171: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/171.jpg)
Dynamics and UICollectionView
• UICollectionViewLayoutAttributes conforms to UIDynamicItem
![Page 172: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/172.jpg)
Dynamics and UICollectionView
• UICollectionViewLayoutAttributes conforms to UIDynamicItem• You can initialize an animator with a layoutanimator = [[UIDynamicAnimator alloc] initWithCollectionViewLayout:myLayout]
![Page 173: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/173.jpg)
Dynamics and UICollectionView
• UICollectionViewLayoutAttributes conforms to UIDynamicItem• You can initialize an animator with a layoutanimator = [[UIDynamicAnimator alloc] initWithCollectionViewLayout:myLayout]
• Just pass UICollectionViewLayoutAttributes to your behaviors
![Page 174: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/174.jpg)
Dynamics and UICollectionView
• UICollectionViewLayoutAttributes conforms to UIDynamicItem• You can initialize an animator with a layoutanimator = [[UIDynamicAnimator alloc] initWithCollectionViewLayout:myLayout]
• Just pass UICollectionViewLayoutAttributes to your behaviors• UIKit will invalidate the layout as needed
![Page 175: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/175.jpg)
Demo
![Page 176: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/176.jpg)
Summary
![Page 177: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/177.jpg)
Summary
• An interaction-oriented animation system
![Page 178: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/178.jpg)
Summary
• An interaction-oriented animation system• Animate key elements
![Page 179: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/179.jpg)
Summary
• An interaction-oriented animation system• Animate key elements• Focus on the user experience
![Page 180: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/180.jpg)
Jake BehrensUI Frameworks [email protected]
DocumentationUIKit Framework Referencehttp://developer.apple.com/library/ios
Apple Developer Forumshttp://devforums.apple.com
More Information
![Page 181: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/181.jpg)
Custom Transitions Using View Controllers Pacific HeightsThursday 11:30AM
Related Sessions
Advanced Techniques with UIKit Dynamics PresidioThursday 3:15PM
Designing Games with Sprite Kit MissionWednesday 2:00PM
Introduction to Sprite Kit PresidioWednesday 11:30AM
![Page 182: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/182.jpg)
Labs
Scroll View, Collection View, and Table View on iOS Lab Frameworks Lab BWednesday 2:00PM
UIKit Dynamics Lab Frameworks Lab AWednesday 4:30PM
Cocoa Touch Animation Lab Frameworks Lab BThursday 2:00PM
Scroll View, Collection View, and Table View on iOS Lab Frameworks Lab BThursday 11:30AM
Cocoa Touch Lab Frameworks Lab BFriday 9:00AM
Cocoa Touch Lab Frameworks Lab AWednesday 9:00AM
Sprite Kit Lab Graphics and Games Lab BWednesday 3:15PM
![Page 183: Getting Started with UIKit Dynamics · 2016-07-09 · These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 206 Getting Started with](https://reader034.fdocuments.net/reader034/viewer/2022042917/5f5b58480d1cc327a17da039/html5/thumbnails/183.jpg)