<!--
{
  "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/UIGravityBehavior/setAngle(_:magnitude:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIGravityBehavior(im)setAngle:magnitude:"
  },
  "title" : "setAngle(_:magnitude:)"
}
-->

# setAngle(_:magnitude:)

Sets the angle and magnitude of the gravity vector for the behavior.

```
func setAngle(_ angle: CGFloat, magnitude: CGFloat)
```

## Parameters

`angle`

The radian angle for the gravity vector, using standard UIKit geometry. Specify the value `pi / 2` to create a force that pulls items downward toward the bottom of the reference view.

`magnitude`

The magnitude of the gravitational force. Specify `1.0` to get the standard UIKit gravity, which has an acceleration value of 1000 points / second².

## Discussion

---

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)