<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIPresentationController/containerViewWillLayoutSubviews()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIPresentationController(im)containerViewWillLayoutSubviews"
  },
  "title" : "containerViewWillLayoutSubviews()"
}
-->

# containerViewWillLayoutSubviews()

Notifies the presentation controller that layout is about to begin on the views of the container view.

```
func containerViewWillLayoutSubviews()
```

## Discussion

UIKit calls this method before adjusting the layout of the views in the container view. Use this method and the [`containerViewDidLayoutSubviews()`](/documentation/UIKit/UIPresentationController/containerViewDidLayoutSubviews()) method to update any custom views managed by your presentation controller.

In iOS 18 and later, UIKit supports automatic trait tracking inside this method for traits from this presentation controller’s `traitCollection` and the `traitCollection` of its [`containerView`](/documentation/UIKit/UIPresentationController/containerView). For more information, see [Automatic trait tracking](/documentation/UIKit/automatic-trait-tracking).

This method supports automatic observation tracking. For more information, see [Updating views automatically with observation tracking in UIKit](/documentation/UIKit/updating-views-automatically-with-observation-tracking-in-uikit).

---

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)