iOS Developer Library

Developer

UIKit Framework Reference UIDynamicBehavior Class Reference

Options
Deployment Target:

On This Page
Language:

UIDynamicBehavior

A dynamic behavior confers a behavioral configuration on one or more dynamic items for their participation in two-dimensional animation. More...

Conforms To


Import Statement


import UIKit @import UIKit;

Availability


Available in iOS 7.0 and later.
  • action action Property

    The block you want to execute during dynamic animation.

    Declaration

    Swift

    var action: (() -> Void)!

    Objective-C

    @property(nonatomic, copy) void (^action)(void)

    Discussion

    The dynamic animator calls the action block on every animation step.

    Import Statement

    import UIKit

    Availability

    Available in iOS 7.0 and later.

  • Adds a dynamic behavior, as a child, to a custom dynamic behavior.

    Declaration

    Swift

    func addChildBehavior(_ behavior: UIDynamicBehavior!)

    Objective-C

    - (void)addChildBehavior:(UIDynamicBehavior *)behavior

    Parameters

    behavior

    The dynamic behavior you want to add as a child.

    The parent behavior ignores your use of this method if you:

    • Provide a nil value

    • Provide a behavior instance that you’ve already added to the behavior

    Discussion

    Call this method only on custom subclasses of the UIDynamicBehavior class.

    Import Statement

    import UIKit

    Availability

    Available in iOS 7.0 and later.

  • Returns the array of dynamic behaviors that are children of a custom dynamic behavior. (read-only)

    Declaration

    Swift

    var childBehaviors: [AnyObject] { get }

    Objective-C

    @property(nonatomic, readonly, copy) NSArray *childBehaviors

    Discussion

    Only custom subclasses of the class can have child behaviors.

    Import Statement

    import UIKit

    Availability

    Available in iOS 7.0 and later.

  • Removes a child dynamic behavior from a custom dynamic behavior.

    Declaration

    Swift

    func removeChildBehavior(_ behavior: UIDynamicBehavior)

    Objective-C

    - (void)removeChildBehavior:(UIDynamicBehavior *)behavior

    Parameters

    behavior

    The child dynamic behavior you want to remove.

    The parent behavior ignores your use of this method if you:

    • Provide a nil value

    • Provide a behavior instance that is not a child of the parent behavior

    Discussion

    This method applies only to custom subclasses of the UIDynamicBehavior class. UIKit concrete dynamic behaviors (such as an instance of UICollisionBehavior) cannot have child behaviors.

    Import Statement

    import UIKit

    Availability

    Available in iOS 7.0 and later.

  • The dynamic animator that the dynamic behavior is associated with. (read-only)

    Declaration

    Swift

    var dynamicAnimator: UIDynamicAnimator? { get }

    Objective-C

    @property(nonatomic, readonly) UIDynamicAnimator *dynamicAnimator

    Discussion

    If the dynamic behavior is not associated with a dynamic animator, the value of this property is nil.

    Import Statement

    import UIKit

    Availability

    Available in iOS 7.0 and later.

  • Called when the dynamic behavior is added to, or removed from, a dynamic animator.

    Declaration

    Swift

    func willMoveToAnimator(_ dynamicAnimator: UIDynamicAnimator?)

    Objective-C

    - (void)willMoveToAnimator:(UIDynamicAnimator *)dynamicAnimator

    Parameters

    dynamicAnimator

    The dynamic animator that the behavior is being added to, or nil if being removed from an animator.

    Discussion

    Use this method as the override point for responding to changes in the UIKit Dynamics behavior tree that involve the dynamic behavior.

    Import Statement

    import UIKit

    Availability

    Available in iOS 7.0 and later.