iOS UIkit Dynamic
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

iOS UIkit Dynamic

on

  • 477 views

 

Statistics

Views

Total Views
477
Views on SlideShare
477
Embed Views
0

Actions

Likes
3
Downloads
4
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

iOS UIkit Dynamic Presentation Transcript

  • 1. UIKIT DYNAMICS 2014
  • 2. INTRODUCTION • comprises four key elements • • The Reference View • Dynamic Items • • The Dynamic Animator Dynamic Behaviors Demo
  • 3. THE DYNAMIC ANIMATOR • Responsible for coordinating the dynamic behaviors • Underlying physics engine to perform the animation • Represented by an instance of the UIDynamicAnimator class
  • 4. EXAMPLE • @property (strong, nonatomic) UIDynamicAnimator *animator; • self.animator = [[UIDynamicAnimator alloc] initWithReferenceView:self.view]; ! ! • Class reference: https://developer.apple.com/library/ios/documentation/uikit/reference/ UIDynamicAnimator_Class/Reference/Reference.html
  • 5. THE REFERENCE VIEW • Interaction are to take place • This is typically the parent superclass view or collection view of which the dynamic item views are children.
  • 6. EXAMPLE • self.animator = [[UIDynamicAnimator alloc] initWithReferenceView:self.view];
  • 7. DYNAMIC ITEMS • the view elements within the user interface that are to be animated • includes the UIView and UICollectionView classes and any subclasses there of (such as UIButton and UILabel)
  • 8. DYNAMIC BEHAVIORS • configure the behavior which is to be applied to one or more dynamic items • predefined dynamic behavior classes • UIAttachmentBehavior • UICollisionBehavior • UIGravityBehavior • UIDynamicItemBehavior • UIPushBehavior • • The force can be specified as continuous or instantaneous UISnapBehavior
  • 9. EXAMPLE Class *gravity = [[Class alloc]initWithItems:@[_view1, _view2]]; [self.animator addBehavior:gravity];
  • 10. UICollisionBehavior Delegate <UICollisionBehaviorDelegate> [collision setCollisionDelegate:self]; • collisionBehavior:beganContactForItem:withBoundaryIdentifier:atPoint: • collisionBehavior:beganContactForItem:withItem:atPoint: • collisionBehavior:endedContactForItem:withBoundaryIdentifier: • collisionBehavior:endedContactForItem:withItem:
  • 11. UIDynamicItemBehavior • AllowsRotation: Permitted to rotate during animation • AngularResistence: The higher the value, the faster the item will stop rotating • Density: The mass of the item • Friction: It slides against another item • Resistence: The item will come to a complete stop during animation. • Elasticity: Item will bounce
  • 12. EXAMPLE UIDynamicItemBehavior *behavior = [[UIDynamicItemBehavior alloc] initWithItems:@[_view1, _view2]]; behavior.elasticity = 0.2; behavior.resistance = 0.5; [self.animator addBehavior:behavior];
  • 13. UIDynamicBehavior • Combined to create a single custom behavior
  • 14. EXAMPLE UIDynamicBehavior *customBehavior = [[UIDynamicBehavior alloc]init]; ! [customBehavior addChildBehavior:behavior]; [customBehavior addChildBehavior:attachment]; [customBehavior addChildBehavior:gravity]; [self.animator addBehavior:customBehavior];
  • 15. UIkit dynamics architecture
  • 16. I have no idea, what this guy was saying
  • 17. Show me the demo
  • 18. DEMO