<!--
{
  "availability" : [
    "iOS: 7.0.0 -",
    "iPadOS: 7.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIAttachmentBehavior/init(item:offsetFromCenter:attachedToAnchor:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIAttachmentBehavior(im)initWithItem:offsetFromCenter:attachedToAnchor:"
  },
  "title" : "init(item:offsetFromCenter:attachedToAnchor:)"
}
-->

# init(item:offsetFromCenter:attachedToAnchor:)

Initializes a behavior where the specified point in a dynamic item is attached to an anchor point.

```
init(item: any UIDynamicItem, offsetFromCenter offset: UIOffset, attachedToAnchor point: CGPoint)
```

## Parameters

`item`

The dynamic item to attach to the specified `point`.

`offset`

The offset from the center of `item` at which to create the attachment. Specifying [`zero`](/documentation/UIKit/UIOffset/zero) creates the attachment at the center of `item`.

`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`](/documentation/UIKit/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. If you specify a nonzero offset value, the item is connected at the specified point instead of the center of the item.

The attachment object returned by this method is of type [`UIAttachmentBehavior.AttachmentType.anchor`](/documentation/UIKit/UIAttachmentBehavior/AttachmentType/anchor).

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)