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

# preferredContentSizeDidChange(for:)

Called when there is a change in value of the [`preferredContentSize`](/documentation/AppKit/NSViewController/preferredContentSize) property of a child view controller or a presented view controller.

```
func preferredContentSizeDidChange(for viewController: NSViewController)
```

## Parameters

`viewController`

The view controller whose [`preferredContentSize`](/documentation/AppKit/NSViewController/preferredContentSize) property value changed.

## Discussion

Override this method if you want to adjust layout when a child view controller or presented view controller changes its preferred content size.

---

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)