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

# sizeToCells()

Changes the width and the height of the receiver’s frame so it exactly contains the cells.

```
func sizeToCells()
```

## Discussion

This method does not redraw the receiver.

## See Also

[`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.

[`func sizeToFit()`](/documentation/AppKit/NSControl/sizeToFit())

Resizes the receiver’s frame so that it’s the minimum size needed to contain its cell.



---

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)