<!--
{
  "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/UIContentContainer/size(forChildContentContainer:withParentContainerSize:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(pl)UIContentContainer(im)sizeForChildContentContainer:withParentContainerSize:"
  },
  "title" : "size(forChildContentContainer:withParentContainerSize:)"
}
-->

# size(forChildContentContainer:withParentContainerSize:)

Returns the size of the specified child view controller’s content.

```
func size(forChildContentContainer container: any UIContentContainer, withParentContainerSize parentSize: CGSize) -> CGSize
```

## Parameters

`container`

The child view controller.

`parentSize`

The size of the parent view controller.

## Return Value

The size to apply to the child view controller.

## Discussion

Container view controllers use this method to return the sizes for their child view controllers. UIKit calls the method as part of the default implementation of the [`viewWillTransition(to:with:)`](/documentation/UIKit/UIContentContainer/viewWillTransition(to:with:)) method for view controllers. It calls the method once for each child view controller embedded in the view controller. If you’re implementing a custom container view controller, you should override this method and use it to return the sizes of the contained children.

View controllers and presentation controllers return the value in `parentSize` by default.

---

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)