Contents

init(item:attachedToAnchor:)

Initializes a behavior where the center of a dynamic item is attached to the specified anchor point.

Declaration

convenience init(item: any UIDynamicItem, attachedToAnchor point: CGPoint)

Parameters

  • item:

    The dynamic item to attach to the specified point.

  • point:

    The anchor point for the item. Specify this point in the coordinate system of the dynamic animator’s reference view. For more information about coordinate systems, see Uidynamicanimator.

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 item to the specified anchor point. The item is free to rotate around the anchor point, but its distance to the anchor point remains fixed.

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

See Also

Creating and initializing attachment behavior objects