Contents

setTranslatesReferenceBoundsIntoBoundary(with:)

Specifies a collision boundary based on the bounds of the animation reference system, with optional insets.

Declaration

func setTranslatesReferenceBoundsIntoBoundary(with insets: UIEdgeInsets)

Parameters

  • insets:

    Insets to apply to the reference system’s bounds when defining the collision boundary.

Discussion

The result of using this method depends on how you’ve initialized the dynamic animator (of class UIDynamicAnimator) that you’ve added the collision behavior to. See the overview in UIDynamicAnimator for a discussion of initialization options and modes for animators.

Here is how the dynamic animator’s initialization impacts use of this method:

  • For a view-only dynamic animator, the reference bounds are those of the reference view

  • For a collection-view dynamic animator, the reference bounds are those of the collection view layout

  • For a dynamic-item dynamic animator, there are no reference bounds.

For a collision behavior added to a view-only or collection-view dynamic animator, activate a reference-system-based collision boundary by setting the translatesReferenceBoundsIntoBoundary property to true.

See Also

Configuring a collision behavior