UIKIT Dynamics for iOS Developers
Upcoming SlideShare
Loading in...5
×
 

UIKIT Dynamics for iOS Developers

on

  • 197 views

This presentation is meant for iOS developers as it will dive deeper into the UIKit framework and focus on how to combine DYNAMICS with the same.

This presentation is meant for iOS developers as it will dive deeper into the UIKit framework and focus on how to combine DYNAMICS with the same.

Statistics

Views

Total Views
197
Views on SlideShare
191
Embed Views
6

Actions

Likes
3
Downloads
1
Comments
0

1 Embed 6

http://www.slideee.com 6

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

UIKIT Dynamics for iOS Developers UIKIT Dynamics for iOS Developers Presentation Transcript

  • UIKIT DYNAMICS Presenter: Neha Sinha, Date: 19/04/2014
  •  High level Objective C framework that provides the classes that are needed to construct and manage an application's user interface for iOS.  Provides an application object, event handling, drawing model, windows, views and controls specifically designed for touch screen interface. Presenter: Neha Sinha, Mindfire Solutions
  • A composable, reusable, declarative, real-world inspired animation and interaction system. Presenter: Neha Sinha, Mindfire Solutions
  •  Core Animation  UIView Animation  Motion Effects  Gesture driven interactions  CADisplayLink  All of the above Presenter: Neha Sinha, Mindfire Solutions
  •  Real world inspired interactions  Combining predefined and interactive animation  Designed for UI Presenter: Neha Sinha, Mindfire Solutions
  • Presenter: Neha Sinha, Mindfire Solutions
  •  Provides the overall context  Defines the coordinate system  Controls the engine  Keeps track of the behaviors Reference View UI DynamicAnimator UIDynamicAnimator* animator = [[UIDynamicAnimator alloc] initWithReferenceView: referenceView]; [animator addBehaviour: ...]; [animator addBehaviour: ...]; Presenter: Neha Sinha, Mindfire Solutions
  •  Confers a behavioral configuration on one or more dynamic items for their participation in 2D animation  Declarative  Describe “influences” on views  Composable  Subclassable myBehavior = [[MyBehavior alloc] initWithItems: @[view1, view2, ...]]; [animator addBehavior:myBehavior];
  •  Any iOS or custom object that confirms to the UIDynamicItem protocol. The UIView and UICollectionViewLayoutAttributes classes implement this protocol.  The UIDynamicItem protocol defines 3 vital properties that allow the UIKitDynamics engine to track animation states over time : bounds–called when a dynamic animator needs the bounds of the dynamic item center–called when the dynamic animator has computed new center point for the dynamic item transform–called when the dynamic animator has computed a new rotation value of the dynamic item @protocol UIDynamicItem <NSObject> @property (nonatomic, readonly) CGRect bounds; @property (nonatomic, readwrite) CGPoint center; @property (nonatomic, readwrite) CGAffineTransform transform; @end Presenter: Neha Sinha, Mindfire Solutions
  • Presenter: Neha Sinha, Mindfire Solutions
  •  Configured with items to animate  Most primitive behaviors support adding and removing items  Can be parameterized before adding to an animator  The influence stops when the behavior is removed Presenter: Neha Sinha, Mindfire Solutions
  •  Gravity  Collision  Attachments  Snap  Forces  Item properties Presenter: Neha Sinha, Mindfire Solutions
  •  A simple gravity vector that applies to all its dynamic items  @property (nonatomic, readwrite) CGFloat xComponent;  @property (nonatomic, readwrite) CGFloat yComponent;  Initializing & managing a Gravity Behavior :  addItem: – (void) addItem: (id <UIDynamicItem>) item  initWithItems: – (instancetype) initWithItems: (NSArray*) items  removeItem: – (void) removeItem: (id <UIDynamicItem>) item Presenter: Neha Sinha, Mindfire Solutions
  • Configuring a Gravity Behavior :  angle – @property (nonatomic, readwrite) CGFloat angle  gravityDirection – @property (nonatomic, readwrite) CGVector gravityDirection  magnitude – @property(nonatomic, readwrite) CGFloat magnitude  setAngle: magnitude: – (void) setAngle: (CGFloat) angle magnitude: (CGFloat)magnitude
  • UIKit Gravity 1000 p/s2 Presenter: Neha Sinha, Mindfire Solutions
  •  A collision behavior confers, to a specified array of dynamic items, the ability of those items to engage in collisions with each other and with the behavior's specified boundaries.  Collision mode : @property (nonatomic, readwrite) UICollisionBehaviorMode collisionMode; UICollisionBehaviorModeItems UICollisionBehaviorModeBoundaries UICollisionBehaviorModeEverything Presenter: Neha Sinha, Mindfire Solutions
  •  Boundaries : • Easy set up using the Reference view @property (nonatomic, readwrite) BOOL translatesReferenceBoundsIntoBoundary; • Or with Insets - (void) setTranslatesReferenceBoundsIntoBoundaryWithInsets: (UIEdgeInsets) insets • Explicitly with segments - (void) addBoundaryWithIdentifier:(id) identifier fromPoint:(CGPoint) p1 toPoint:(CGPoint) p2 • Or paths (approximated) - (void) addBoundaryWithIdentifier:(id) identifier forPath:(UIBezierPath*) path C = [[UICollisionBehavior alloc] initWithItems:@[view]]; [c addBoundaryWithIdentifier:@”Wall1” fromPoint:p1 toPoint:p2]; Presenter: Neha Sinha, Mindfire Solutions
  •  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: Presenter: Neha Sinha, Mindfire Solutions
  •  Between a dynamic item and an anchor point : a1 = [[UIAttachmentBehavior alloc] initWithItem: v1 attachedToAnchor: ap];  Between two dynamic items : a2 = [[UIAttachmentBehavior alloc] initWithItem: v1 attachedToItem: v2];  The dynamic item attachment point can be an offset from the center : a1 = [[UIAttachmentBehavior alloc] initWithItem:v1 offsetFromCenter:center attachedToAnchor:ap]; a2 = [[UIAttachmentBehavior alloc] initWithItem:v1 offsetFromCenter:center1 attachedToItem:v2 offsetFromCenter:center2];  The attachment can act like a spring: [a1 setFrequency: 4.0]; [a1 setDamping: 0.5]; Presenter: Neha Sinha, Mindfire Solutions
  •  Defines a dynamic item's movement to a specified point; the movement proceeds with a spring-like effect, ending with an oscillation. s = [[UISnapBehavior alloc] initWithItem:view snapToPoint:point]; [animator addBehavior:s];  Damping is customizable.  The valid range for damping extends from 0.0 for minimum oscillation, through 1.0, for maximum oscillation. Default value is 0.5. Presenter: Neha Sinha, Mindfire Solutions
  •  Applies a continuous or instantaneous force to one or more dynamic items, causing those items to change position accordingly. p = [[UIPushBehavior alloc] initWithItems:@[view] mode:UIPushBehaviorModeContinuous];  A simple force vector @property (nonatomic, readwrite) CGFloat xComponent; @property (nonatomic, readwrite) CGFloat yComponent; @property (nonatomic, readwrite) CGFloat angle; @property (nonatomic, readwrite) CGFloat magnitude; Presenter: Neha Sinha, Mindfire Solutions
  • Presenter: XXXX XXXX, Mindfire Solutions The UIKit Newton Accelerates a (100,100) view at a rate of 100 p/s2 Presenter: Neha Sinha, Mindfire Solutions
  •  Represents a base dynamic animation configuration for one or more dynamic items.  Change item level properties: Friction resistance angularResistance elasticity density allowsRotation  Directly add angular or linear velocities to dynamic items. Presenter: Neha Sinha, Mindfire Solutions
  •  UICollectionViewLayoutAttributes conforms to UIDynamicItem  Initialize an animator with a layout: animator = [[UIDynamicAnimator alloc] initWithCollectionViewLayout:myLayout];  Just pass UICollectionViewLayoutAttributes to your behaviors  UIKit will invalidate the layout as needed. Presenter: Neha Sinha, Mindfire Solutions
  • Presenter: XXXX XXXX, Mindfire Solutions Queries Please !!! Presenter: Neha Sinha, Mindfire Solutions
  • Thank You Presenter: Neha Sinha, Mindfire Solutions
  • www.mindfiresolutions.com https://www.facebook.com/MindfireSolutions http://www.linkedin.com/company/mindfire-solutions http://twitter.com/mindfires Presenter: Neha Sinha, Mindfire Solutions