<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSView/discardCursorRects()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSView(im)discardCursorRects"
  },
  "title" : "discardCursorRects()"
}
-->

# discardCursorRects()

Invalidates all cursor rectangles set up using [`addCursorRect(_:cursor:)`](/documentation/AppKit/NSView/addCursorRect(_:cursor:)).

```
func discardCursorRects()
```

## Discussion

You need never invoke this method directly; neither is it typically invoked during the invalidation of cursor rectangles.  [`NSWindow`](/documentation/AppKit/NSWindow) automatically invalidates cursor rectangles in response to [`invalidateCursorRects(for:)`](/documentation/AppKit/NSWindow/invalidateCursorRects(for:)) and before the view’s cursor rectangles are reestablished using [`resetCursorRects()`](/documentation/AppKit/NSView/resetCursorRects()).  This method is invoked just before the view is removed from a window and when the view is deallocated.

## See Also

[`func discardCursorRects()`](/documentation/AppKit/NSWindow/discardCursorRects())

Invalidates all cursor rectangles in the window.



---

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)