Contents

init(item:attachedTo:)

Initializes a behavior where the centers of two dynamic items are attached to each other.

Declaration

convenience init(item item1: any UIDynamicItem, attachedTo item2: any UIDynamicItem)

Parameters

  • item1:

    The first of two dynamic items connected by the attachment behavior.

  • item2:

    The second of two dynamic items connected by the attachment behavior.

Return Value

The initialized attachment behavior, or nil if there was a problem initializing the object

Discussion

The behavior created by this method acts like a solid rod connecting the two items at their center points. Forces applied to one item push or pull the other item accordingly. The items are free to rotate around each other but always remain the same distance apart.

The attachment object returned by this method is of type UIAttachmentBehavior.AttachmentType.items.

See Also

Creating and initializing attachment behavior objects