<!--
{
  "documentType" : "article",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/view-coordinates",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "View Coordinates"
}
-->

# View Coordinates

Manage the frame and bounds rectangles that determine the size and position of the view in the view hierarchy.

## Topics

### Modifying the Frame Rectangle

[`var frame: NSRect`](/documentation/AppKit/NSView/frame)

The view’s frame rectangle, which defines its position and size in its superview’s coordinate system.

[`func setFrameOrigin(NSPoint)`](/documentation/AppKit/NSView/setFrameOrigin(_:))

Sets the origin of the view’s frame rectangle to the specified point, effectively repositioning it within its superview.

[`func setFrameSize(NSSize)`](/documentation/AppKit/NSView/setFrameSize(_:))

Sets the size of the view’s frame rectangle to the specified dimensions, resizing it within its superview without affecting its coordinate system.

[`var frameRotation: CGFloat`](/documentation/AppKit/NSView/frameRotation)

The angle of rotation, measured in degrees, applied to the view’s frame rectangle relative to its superview’s coordinate system.

[`class let frameDidChangeNotification: NSNotification.Name`](/documentation/AppKit/NSView/frameDidChangeNotification)

A notification that posts when the view’s frame rectangle changes to a new value.

[`struct FrameDidChangeMessage`](/documentation/AppKit/NSView/FrameDidChangeMessage)

[`var postsFrameChangedNotifications: Bool`](/documentation/AppKit/NSView/postsFrameChangedNotifications)

A Boolean value indicating whether the view posts notifications when its frame rectangle changes.

### Modifying the bounds rectangle

[`var bounds: NSRect`](/documentation/AppKit/NSView/bounds)

The view’s bounds rectangle, which expresses its location and size in its own coordinate system.

[`func setBoundsOrigin(NSPoint)`](/documentation/AppKit/NSView/setBoundsOrigin(_:))

Sets the origin of the view’s bounds rectangle to a specified point.

[`func setBoundsSize(NSSize)`](/documentation/AppKit/NSView/setBoundsSize(_:))

Sets the size of the view’s bounds rectangle to specified dimensions, inversely scaling its coordinate system relative to its frame rectangle.

[`var boundsRotation: CGFloat`](/documentation/AppKit/NSView/boundsRotation)

The angle of rotation, measured in degrees, applied to the view’s bounds rectangle relative to its frame rectangle.

[`class let boundsDidChangeNotification: NSNotification.Name`](/documentation/AppKit/NSView/boundsDidChangeNotification)

A notification that posts when the view’s bounds rectangle changes to a new value independently of the frame rectangle.

[`struct BoundsDidChangeMessage`](/documentation/AppKit/NSView/BoundsDidChangeMessage)

[`var postsBoundsChangedNotifications: Bool`](/documentation/AppKit/NSView/postsBoundsChangedNotifications)

A Boolean value indicating whether the view posts notifications when its bounds rectangle changes.

### Examining Coordinate System Modifications

[`var isFlipped: Bool`](/documentation/AppKit/NSView/isFlipped)

A Boolean value indicating whether the view uses a flipped coordinate system.

[`var isRotatedFromBase: Bool`](/documentation/AppKit/NSView/isRotatedFromBase)

A Boolean value indicating whether the view or any of its ancestors has ever had a rotation factor applied to its frame or bounds.

[`var isRotatedOrScaledFromBase: Bool`](/documentation/AppKit/NSView/isRotatedOrScaledFromBase)

A Boolean value indicating whether the view or any of its ancestors has ever had a rotation factor applied to its frame or bounds, or has been scaled from the window’s base coordinate system.

### Modifying the Coordinate System

[`func translateOrigin(to: NSPoint)`](/documentation/AppKit/NSView/translateOrigin(to:))

Translates the view’s coordinate system so that its origin moves to a new location.

[`func scaleUnitSquare(to: NSSize)`](/documentation/AppKit/NSView/scaleUnitSquare(to:))

Scales the view’s coordinate system so that the unit square scales to the specified dimensions.

[`func rotate(byDegrees: CGFloat)`](/documentation/AppKit/NSView/rotate(byDegrees:))

Rotates the view’s bounds rectangle by a specified degree value around the origin of the coordinate system, (0.0, 0.0).

### Converting Coordinate Values

[`func backingAlignedRect(NSRect, options: AlignmentOptions) -> NSRect`](/documentation/AppKit/NSView/backingAlignedRect(_:options:))

Returns a backing store pixel-aligned rectangle in local view coordinates.

[`func convertFromBacking(NSPoint) -> NSPoint`](/documentation/AppKit/NSView/convertFromBacking(_:)-229ps)

Converts a point from its pixel aligned backing store coordinate system to the view’s interior coordinate system.

[`func convertToBacking(NSPoint) -> NSPoint`](/documentation/AppKit/NSView/convertToBacking(_:)-2xx45)

Converts a point from the view’s interior coordinate system to its pixel aligned backing store coordinate system.

[`func convertFromLayer(NSPoint) -> NSPoint`](/documentation/AppKit/NSView/convertFromLayer(_:)-3nsbu)

Convert the point from the layer’s interior coordinate system to the view’s interior coordinate system.

[`func convertToLayer(NSPoint) -> NSPoint`](/documentation/AppKit/NSView/convertToLayer(_:)-44u7d)

Convert the size from the view’s interior coordinate system to the layer’s interior coordinate system.

[`func convertFromBacking(NSRect) -> NSRect`](/documentation/AppKit/NSView/convertFromBacking(_:)-2njpa)

Converts a rectangle from its pixel aligned backing store coordinate system to the view’s interior coordinate system.

[`func convertToBacking(NSRect) -> NSRect`](/documentation/AppKit/NSView/convertToBacking(_:)-3zors)

Converts a rectangle from the view’s interior coordinate system to its pixel aligned backing store coordinate system.

[`func convertFromLayer(NSRect) -> NSRect`](/documentation/AppKit/NSView/convertFromLayer(_:)-8s5bi)

Convert the rectangle from the layer’s interior coordinate system to the view’s interior coordinate system.

[`func convertToLayer(NSRect) -> NSRect`](/documentation/AppKit/NSView/convertToLayer(_:)-160pw)

Convert the size from the view’s interior coordinate system to the layer’s interior coordinate system.

[`func convertFromBacking(NSSize) -> NSSize`](/documentation/AppKit/NSView/convertFromBacking(_:)-4agf9)

Converts a size from its pixel aligned backing store coordinate system to the view’s interior coordinate system.

[`func convertToBacking(NSSize) -> NSSize`](/documentation/AppKit/NSView/convertToBacking(_:)-4ra9y)

Converts a size from the view’s interior coordinate system to its pixel aligned backing store coordinate system.

[`func convertFromLayer(NSSize) -> NSSize`](/documentation/AppKit/NSView/convertFromLayer(_:)-3usqp)

Convert the size from the layer’s interior coordinate system to the view’s interior coordinate system.

[`func convertToLayer(NSSize) -> NSSize`](/documentation/AppKit/NSView/convertToLayer(_:)-2vozx)

Convert the size from the view’s interior coordinate system to the layer’s interior coordinate system.

[`func convert(NSPoint, from: NSView?) -> NSPoint`](/documentation/AppKit/NSView/convert(_:from:)-1dq9l)

Converts a point from the coordinate system of a given view to that of the view.

[`func convert(NSPoint, to: NSView?) -> NSPoint`](/documentation/AppKit/NSView/convert(_:to:)-6u9ir)

Converts a point from the view’s coordinate system to that of a given view.

[`func convert(NSSize, from: NSView?) -> NSSize`](/documentation/AppKit/NSView/convert(_:from:)-40x0w)

Converts a size from another view’s coordinate system to that of the view.

[`func convert(NSSize, to: NSView?) -> NSSize`](/documentation/AppKit/NSView/convert(_:to:)-5nptx)

Converts a size from the view’s coordinate system to that of another view.

[`func convert(NSRect, from: NSView?) -> NSRect`](/documentation/AppKit/NSView/convert(_:from:)-7fbb6)

Converts a rectangle from the coordinate system of another view to that of the view.

[`func convert(NSRect, to: NSView?) -> NSRect`](/documentation/AppKit/NSView/convert(_:to:)-3cqqt)

Converts a rectangle from the view’s coordinate system to that of another view.

[`func centerScanRect(NSRect) -> NSRect`](/documentation/AppKit/NSView/centerScanRect(_:))

Converts the corners of a specified rectangle to lie on the center of device pixels, which is useful in compensating for rendering overscanning when the coordinate system has been scaled.



---

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)