<!--
{
  "availability" : [
    "iOS: 10.0.0 - 14.0.0",
    "iPadOS: 10.0.0 - 14.0.0",
    "macCatalyst: 10.0.0 - 14.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "NotificationCenter",
  "identifier" : "/documentation/NotificationCenter/NCWidgetProviding/widgetActiveDisplayModeDidChange(_:withMaximumSize:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Notification Center"
    ],
    "preciseIdentifier" : "c:objc(pl)NCWidgetProviding(im)widgetActiveDisplayModeDidChange:withMaximumSize:"
  },
  "title" : "widgetActiveDisplayModeDidChange(_:withMaximumSize:)"
}
-->

# widgetActiveDisplayModeDidChange(_:withMaximumSize:)

Called when the active display mode changes.

```
optional func widgetActiveDisplayModeDidChange(_ activeDisplayMode: NCWidgetDisplayMode, withMaximumSize maxSize: CGSize)
```

## Parameters

`activeDisplayMode`

The new active display mode. See [`NCWidgetDisplayMode`](/documentation/NotificationCenter/NCWidgetDisplayMode) for possible values.

`maxSize`

A <doc://com.apple.documentation/documentation/CoreFoundation/CGSize> object that represents the new maximum size this widget can have.

## Discussion

You might implement this method if your widget should change its <doc://com.apple.documentation/documentation/UIKit/UIViewController/preferredContentSize> value to better accommodate the new display mode.

Widgets displayed as [`NCWidgetDisplayMode.compact`](/documentation/NotificationCenter/NCWidgetDisplayMode/compact) have a fixed size passed in the `maxSize` parameter.

---

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)