A dynamic behavior confers a behavioral configuration on one or more dynamic items for their participation in two-dimensional animation.
- iOS 7.0+
- tvOS 7.0+
A dynamic item is any iOS or custom object that conforms to the
UIDynamicItem protocol. The
UICollectionViewLayoutAttributes classes implement this protocol starting in iOS 7.0. You can implement this protocol to use a dynamic animator with custom objects for such purposes as reacting to rotation or position changes computed by an animator—an instance of the
This parent class,
UIDynamicBehavior, is inherited by the primitive dynamic behavior classes
You can subclass
UIDynamicBehavior. By using the
addChildBehavior(_:) method in an instance of this class or in a custom subclass, you can create composite behaviors of your own design.
When you subclass
UIDynamicBehavior, you typically need to provide one or more initializers, along with other housekeeping methods such as those implemented in the iOS primitive dynamic behaviors.
To perform per-step logic in a dynamic animation, provide a block object using the
To access the dynamic animator that a dynamic behavior is associated with, use the
dynamicAnimator property. To respond to a dynamic behavior being added to or removed from a dynamic animator, implement the